aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/subr.el10
1 files changed, 9 insertions, 1 deletions
diff --git a/lisp/subr.el b/lisp/subr.el
index ed93fa4c6a9..e985125263e 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -551,7 +551,15 @@ FUNCTION is added at the end.
551 551
552HOOK should be a symbol, and FUNCTION may be any valid function. If 552HOOK should be a symbol, and FUNCTION may be any valid function. If
553HOOK is void, it is first set to nil. If HOOK's value is a single 553HOOK is void, it is first set to nil. If HOOK's value is a single
554function, it is changed to a list of functions." 554function, it is changed to a list of functions.
555
556Note: if you make a hook variable buffer-local, copy its value before
557you use `add-hook' to add to it. For example,
558
559 (make-local-variable 'foo-hook)
560 (if (boundp 'foo-hook)
561 (setq foo-hook (copy-sequence foo-hook)))
562 (add-hook 'foo-hook 'my-foo-function)"
555 (or (boundp hook) (set hook nil)) 563 (or (boundp hook) (set hook nil))
556 ;; If the hook value is a single function, turn it into a list. 564 ;; If the hook value is a single function, turn it into a list.
557 (let ((old (symbol-value hook))) 565 (let ((old (symbol-value hook)))