Carbon EmacsにMagitをインストールする
公開:2010年01月20日Carbon Emacsのパッケージを2010年冬版に入れ替えたら、/Application/Emacs.app下にインストールしていたMagitが消えちゃったので、gitから再インストール。make installまでは成功したので、そこまでの手順をメモしておきます。
- リポジトリを複製
$ git clone git://gitorious.org/magit/mainline.git
(※ git clone git://github.com/jdhuntington/magit.git でも取れるが、公式サイトで指定されている gitorious のほうがベター)
- 前準備
$ ./autogen.sh $ ./configure --prefix=/Application/Emacs.app/Contents/Resources --infodir=/Applications/Emacs.app/Contents/Resources
- Makefileを書き換える
Magitのconfigureは、--with-emacsと--with-lispdirオプションを認識せず、makeにEMACS/LISPDIRオプションを渡しても無視されるので、手動でMakefileを書き換える。
$ diff Makefile.old Makefile 170,171c170,171 < lispdir = $(datadir)/emacs/site-lisp < sitestartdir = $(sysconfdir)/emacs/site-start.d --- > lispdir = /Applications/Emacs.app/Contents/Resources/site-lisp/ > sitestartdir = /Applications/Emacs.app/Contents/Resources/site-lisp/site-start.d 764c764 < emacs --batch --eval '(byte-compile-file "$*.el")' --- > /Applications/Emacs.app/Contents/MacOS/Emacs --batch --eval '(byte-compile-file "$*.el")'
- make & make install
$ make $ sudo make install
上の手順で、Carbon Emacsのパッケージ構成にマッチした場所に、Magitのinfo/elispがインストールされる。
ただし、ステータスの表示やdiff/historyの表示、ブランチの変更といった処理は成功するものの、変更をstageしてからコミットしようとすると、
Symbol's function definition is void: start-file-process
というエラーメッセージが出て、コミットに失敗してしまう。
同じ変更内容で、コマンドライン/Git Gui.appからのコミットに成功することは確認済み。まだ解決していないのだけど、とりあえずここまでメモしておきます。
参考
- MacWiki - CarbonEmacsPackage/追加ライブラリのインストール手順
- magit.el を試してみた - うっかりプログラミング日誌
- magit.elを試す【盛大に失敗!】 TestTestTest/ウェブリブログ
MagitがCommitで失敗する話のつづき
Carbon EmacsにMagit再インストール話の続きで、ステータスを見たりdiffを取ったりブランチを変更したりはできるのに、Magitから変更をコミットしようとすると、"Symbol's function definition is void: start-file-process"というエラーメッセージが出て失敗するお話。
"start-file-process"で検索してみると、この関数はEmacs 23から実装されたのだそうで。Carbon EmacsのベースはEmacs 22だから、関数が定義されてないって言われちゃうわけですね。
昨晩記事を書いて寝床についた後に、そういえばMacにはTime Machineという仕組みがあるんだった、と思いだしたので、今朝起きてから、ターミナル経由でTime Machineに潜入。アップグレード前のEmacs.appにインストールされていたmagit.elを復元してみました。
Diffを取ってみると:
$ diff magit.el /Applications/Emacs.app/Contents/Resources/site-lisp/magit.el 244a245,250 > (defun magit-git-insert (args) > (apply #'process-file > magit-git-executable > nil (list t nil) nil > (append magit-git-standard-options args))) > 249,252c255 < (apply #'process-file < magit-git-executable < nil (list t nil) nil < args)))) --- > (magit-git-insert args)))) 261c264,265 < (apply #'process-file magit-git-executable nil nil nil args)) --- > (apply #'process-file magit-git-executable nil nil nil > (append magit-git-standard-options args))) 654c658 < (apply 'process-file cmd nil t nil args) --- > (apply 'process-file cmd nil t nil (append magit-git-standard-options args)) 1020c1024 < (apply 'start-process cmd buf cmd args)) --- > (apply 'start-file-process cmd buf cmd args)) 1053c1057 < (equal (apply 'call-process cmd nil buf nil args) 0)) --- > (equal (apply 'process-file cmd nil buf nil args) 0)) 1628,1629c1632 < (args (append magit-git-standard-options < (list "diff") --- > (args (append (list "diff") 1634c1637 < (apply 'process-file cmd nil t nil args) --- > (magit-git-insert args) 2858c2861 < (let ((res (magit-git-exit-code "log" "--decorate" "--max-count=0"))) --- > (let ((res (magit-git-exit-code "log" "--decorate=full" "--max-count=0"))) 2871c2874 < ,@(if magit-have-decorate (list "--decorate")) --- > ,@(if magit-have-decorate (list "--decorate=full"))
と、たしかにstart-processまわりに変更が入ってます。
というわけで、Carbon Emacs(またはEmacs 22.x)使いの人は、最新版でない古いバージョンのMagitを使用する必要あり。
$ git clone git://gitorious.org/magit/mainline.git $ cd mainline $ git tag -l (※オプション。タグ一覧を表示) $ git checkout magit_0.7
で、0.7あたりを取り出して使うのが、とりあえずの正解です。
