来自 C-h f 添加钩子(Hook):
HOOK should be a symbol, and FUNCTION may be any valid function. If
HOOK is void, it is first set to nil. If HOOK's value is a single
function, it is changed to a list of functions.
来自代码:
(defun add-hook (hook function &optional append local)
...
(or (boundp hook) (set hook nil))
(or (default-boundp hook) (set-default hook nil))
...
这有什么用?我认为它在某种程度上是有用的,否则它不会存在......我只是想不出它有什么好的用途......
最佳答案
它允许您在加载定义它们的包之前设置钩子(Hook)变量。
关于emacs - 为什么 add-hook 允许 `hook' 无效?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21104788/