by shigemk2

当面は技術的なことしか書かない

git commitのエディタをemacsにしたい

全くもって中身のないエントリでございますが、
Gitのcore.editorにEmacsを指定する試行錯誤(Macの場合) (Kanasansoft Web Lab.)
こちらを参考に致しました。ありがとうございます。

.gitconfigに、以下のように書き、

[core]
editor = /Applications/Emacs.app/Contents/MacOS/bin/emacsclient --alternate-editor /Applications/Emacs.app/Contents/MacOS/Emacs

また、init.elに

;;;サーバ起動
(server-start)
;;;クライアントを終了するとき終了するかどうかを聞かない
(remove-hook 'kill-buffer-query-functions 'server-kill-buffer-query-function)

ちなみに、普通に

editor = emacs

と書いても、Emacs.appは起動されず、ターミナル上でemacsが起動されてしまい、日本語が入力できなかったりと何かと不便。

また、

editor = open -a emacs

と書いてコミットをしようとしても、

% git commit
Aborting commit due to empty commit message.
%

だめだよ、めっ☆とされてしまうから、注意です。

追記:edit =うんたんは、.zshenvあたりに書くとよいようです。