【发布时间】:2015-01-21 12:50:34
【问题描述】:
我是 emacs 和 lisp 的新手。
我想在保存点文件时自动加载它。意思是,当我保存我的 .emacs 文件时,它会自动调用 load-file (因此如果我搞砸了,我会立即知道)。
但我看不到能够在 emacs 中找到有关钩子的综合教程。
这是我想出的:
(defun load-init-after-save ()
"After saving this file, load it"
(if (eq bname this) ('load-file this) (nil))
)
(add-hook 'after-save-hook 'load-init-after-save)
当然,这是不正确的:bname 和 this 只是占位符。而且我不希望这个函数在所有保存时都运行,就在 .emacs 文件被保存时。
有人知道怎么做吗?有没有更好、更简单的方法?
【问题讨论】: