EmacsをHomebrewでインストール

Cocoa Emacs を HomeBrew でインストールしました。

HomeBrewのインストールは、簡単です。ターミナルで下記のコマンドを実行するだけ(Lionの場合)

$ ruby -e "$(curl -fsSL https://raw.github.com/gist/323731)"

homebrewに入っているemacsはLionでコンパイルできないためLion対応のレシピをダウンロードしてインストールします。

$ curl -O https://raw.github.com/gist/1124161/6a265cd3b6b35b9dd550d26896063c3dfba6f4fa/emacs.rb

Shiftキーを押したときの挙動がおかしいのでパッチを追加(Shiftキーを押すと記号などが半角で確定入力されてしまいます)

    if ARGV.include? "--cocoa"
      # Fullscreen patch, works against 23.3 and HEAD.
      p1 << "https://raw.github.com/gist/1012927"
      # Shift-Key Patch
      p1 << "http://cloud.github.com/downloads/typester/emacs/fix-shiftmodifier-with-ime.patch"
    end
    • lionオプションをつけることでlionのフルスクリーンに対応します。
$ brew install ./emacs --cocoa --lion

.bashrcにaliasを追加

alias emacs="/usr/local/Cellar/emacs/23.3a/Emacs.app/Contents/MacOS/Emacs"

ターミナル上で動かしたい場合は、-nw オプションをつけます。

alias emacs="/usr/local/Cellar/emacs/23.3a/Emacs.app/Contents/MacOS/Emacs -nw"

MacPortsよりもシンプルでいい感じです。