- 諸事情によりロード済みのライブラリが置いてあるパス(
/path/to/hoge.el
)を知りたい - せっかくだから、ライブラリだけじゃなくて変数や関数が定義されてる場所も!
- そういえば describe-function や describe-variables で表示される help-mode だと飛べる
- help-mode 読んでみよう
の結果、help-fns.el に find-lisp-object-file-name
という便利関数があった
(find-library-name "url") "/Users/gongo/.homebrew/Cellar/emacs/24.2/share/emacs/24.2/lisp/url/url.el.gz" (find-library-name "simple-httpd") "/Users/gongo/.emacs.d/elpa/simple-httpd-20121224.1121/simple-httpd.el" (find-lisp-object-file-name 'httpd-status-codes 'defvar) "/Users/gongo/.emacs.d/elpa/simple-httpd-20121224.1121/simple-httpd.el" (find-lisp-object-file-name 'deferred:$ 'defun) "/Users/gongo/.emacs.d/elpa/deferred-20120306.1807/deferred.el"
便利
追記
今起動している Emacs のある場所を知りたいとつぶやいたら
@gongoZ invocation-directory で実行されている Emacs のあるディレクトリがわかります.
2013-02-06 08:23:40 via KeySnail to @gongoZ
invocation-directory "/Users/gongo/.homebrew/Cellar/emacs/24.2/Emacs.app/Contents/MacOS/" invocation-name "Emacs"
ありがとうございます!!