微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

emacs – elisp:有没有办法获取当前.el模块的名称(如C中的__FILE__)?

在我的elisp模块的顶部,我想做一些简单的事情:
(message (concat "Loading " (expand-file-name (current-elisp-module) ".")))

解决方法

您可以使用由功能 load设置的变量 load-file-name,记录如下:

Full name of file being loaded by `load’.

正如手册中所阐述的:

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.

注意:buffer-file-name作为一个例程不能像你所期望的那样工作.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐