从正在加载和运行的lisp文件中,emacs -l path/to/script/foo.el
我可以获得运行文件的路径吗?
例如,有没有办法确定path/to/script
内部是foo.el
什么?
我对lisp不是很有经验所以请温柔地对待你的解决方案.
Windows 7上的Emacs 22.3.1
Tre*_*son 26
变量load-file-name
在加载时绑定到文件名.要获取目录,您只需使用file-name-directory
,如下所示:
(file-name-directory load-file-name)
Run Code Online (Sandbox Code Playgroud)