LoginSignup
1
1

More than 5 years have passed since last update.

Emacs LispパッケージのFormulaをつくるときの注意

Last updated at Posted at 2014-05-02

Emacs LispパッケージのFormulaをつくるとき、depends_on "emacs"の他
system "./configure", "--prefix=#{prefix}", "--with-emacs=/usr/local/bin/emacs"
"--with-emacs=/usr/local/bin/emacs"を忘れないようにしましょう。

example.rb
require 'formula'

class Example < Formula
  # ...
  depends_on "emacs"
  # ...
  def install
    system "./configure", "--prefix=#{prefix}", "--with-emacs=/usr/local/bin/emacs"
    # ...
  end
  # ...
end

忘れてしまうと、/usr/bin/emacs、すなわち以前のバージョンのEmacsでバイトコンパイルされます。

たいていのEmacs Lispパッケージでは問題が露見しないのですが、Mew-6.6で問題が発生しました。

Mew-6.6で登場したmew-called-interactively-pは、(>= emacs-major-version 24)のときにマクロで、それ以外のときにエイリアスで実装されているのですが、バイトコンパイルされるとこの箇所がEmacs 24(Homebrewのemacs)に合ったコードとしてではなくEmacs 22に合ったコードとしてコンパイルされてしまいます。

mew-env.el
;;; ...
(cond 
 ((>= emacs-major-version 24)
  ;; this must be macro. If implemented as a function, its behavior
  ;; is changed.
  (defmacro mew-called-interactively-p ()
    '(called-interactively-p 'interactive)))
 (t
  (defalias 'mew-called-interactively-p 'called-interactively-p)))
;;; ...
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1