开发者

elisp: Is there a way to get the name of the current .el module (like __FILE__ in C)?

开发者 https://www.devze.com 2022-12-15 12:27 出处:网络
At t开发者_JAVA技巧he top of my elisp module, I want to do something as simple as: (message (concat \"Loading \" (expand-file-name (current-elisp-module) \".\")))

At t开发者_JAVA技巧he top of my elisp module, I want to do something as simple as:

(message (concat "Loading " (expand-file-name (current-elisp-module) ".")))


You can use the variable load-file-name, which is set by the function load, documented as follows:

Full name of file being loaded by `load'.

As elaborated in the manual:

When Emacs is in the process of loading a file, this variable’s value is the name of that file, as Emacs found it during the search described earlier in this section.

Note: buffer-file-name as a routine does not work as you might expect it to.

0

精彩评论

暂无评论...
验证码 换一张
取 消