我在我的Emacs设置中进行了一些重构,并且得出结论我想使用与默认文件不同的初始文件.所以基本上,在我的〜/ .emacs文件中,我有这个:
(load "/some/directory/init.el")
Run Code Online (Sandbox Code Playgroud)
到目前为止,这一切都很好.但是,现在我想重新定义一个我用了很久的旧命令,它会打开我的init文件:
(defun conf ()
"Open a buffer with the user init file."
(interactive)
(find-file user-init-file))
Run Code Online (Sandbox Code Playgroud)
如你所见,无论我做什么,这都会打开〜/ .emacs.我希望它打开/some/directory/init.el,或者在conf命令本身定义的任何地方.
我该怎么办?
你可以使用find-function这个:
(defun conf ()
"Open a buffer with the user init file."
(interactive)
(find-function this-command))
Run Code Online (Sandbox Code Playgroud)