2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Flymake を有効にしていると Magit の Ediff でエラーが発生する

Last updated at Posted at 2012-06-27

Ruby でファイルを開くと Flymake が有効になるように設定しているのだが、Magit で e を押して Ediff による比較をするとき、以下のようなエラーが発生する。

error in process filter: flymake-get-file-name-mode-and-masks: Invalid file-name
error in process filter: Invalid file-name
error in process sentinel: flymake-get-file-name-mode-and-masks: Invalid file-name
error in process sentinel: Invalid file-name

Ediff が使えないわけではないのだが、Magit で Ediff を起動した直後はエラー発生で固まって非常に鬱陶しいのでいろいろ調べてみた。

発生箇所は magit.el の magit-show 関数内部、2769行目の (normal-mode) のようだ。ここで flymake-mode がロードされ、最終的に flymake.el の flymake-get-file-name-mode-and-masks 関数内部、289行目で引数のファイル名が不正なためにエラーを出力している。

ステップ実行だとエラーを出力しないので外部プロセス関連かとは思うのだが、原因究明はあまりにも面倒なので以下のように応急処置で対処することにした。

(defadvice magit-ediff (around flymake-off activate)
  (remove-hook 'ruby-mode-hook 'ruby-flymake-hooks)
  ad-do-it
  (add-hook 'ruby-mode-hook 'ruby-flymake-hooks))

magit-ediff 開始時に Ruby の Flymake 関連のフックを削除し、Ediff の準備が完了したら元に戻すというもの。とりあえずエラーが発生しなくなったので、原因がわかるまではこれで凌ごうと思う。

もしも同じ問題を解決した人がいれば是非教えてほしい。

2
2
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
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?