2011-01-25

anything-config.elで定義されている、anything-c-find-files-icons-directoryでコケる (解決編)

先日の問題は解決しました。ちょっと不恰好だけですけど、以下のパッチをanything-config.elに当てるとひとまず解決です。

--- anything-config.el.orig 2011-01-21 23:13:54.000000000 +0900
+++ anything-config.el 2011-01-25 16:46:04.000000000 +0900
@@ -737,7 +737,9 @@

(defcustom anything-c-find-files-icons-directory
(and (window-system)
- (concat (car image-load-path) "tree-widget/default"))
+ (dolist (i image-load-path)
+ (if (file-directory-p (expand-file-name "tree-widget/default" (eval i)))
+ (return (expand-file-name "tree-widget/default" (eval i))))))
"*Default path where to find files and directory icons."
:type 'string
:group 'anything-config)

問題が起きる条件は下記のとおり。
  • OS : Fedora 14
  • Emacs : emacs-23.2-7.fc14.x86_64
  • Mew : emacs-mew-6.3-2.fc14.x86_64
  • anything-config.el : 0.4.1
で、問題の原因は下記のとおり。
  • anything-config.elで定義されているanything-c-find-files-icons-directoryでimage-load-pathの先頭にあるmew-icon-directoryが文字列ではないため、concatが失敗している
  • 問題のimage-load-pathの先頭にあるmew-icon-directoryはemacs-mewパッケージに含まれる/usr/share/site-lisp/site-start.d/mew-init.elで追加されている
というわけで、この問題を解決するだけだったら、(car image-load-path)(eval (car image-load-path))するだけで良いはずです。カンがいい人はわかると思いますが、オリジナルのanything-config.elの処理だと、環境が違うとanything-c-find-files-icons-directoryの結果が違い、かつ、実在しないディレクトリを指す可能性があります。というわけで、冒頭のようなパッチを書きましたとさ。
本当は2回も(expand-file-name "tree-widget/default" (eval i))しているところがダサいので、何とかしたい気もするんですが、動くからいいや。

0 件のコメント: