summaryrefslogtreecommitdiff
path: root/lisp/subr.el
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1994-09-20 00:59:24 +0000
committerRichard M. Stallman <rms@gnu.org>1994-09-20 00:59:24 +0000
commit95de4f718ea6f8397eb0037695e769016a145e4e (patch)
tree5c9dc215a6d8bf3db1da0d0b9479889d0fbfb6eb /lisp/subr.el
parentb9f431df69a89ce0e48b5f2f4e231a9c1b6cc99c (diff)
downloademacs-95de4f718ea6f8397eb0037695e769016a145e4e.tar.gz
(add-hook): Doc fix.
Diffstat (limited to 'lisp/subr.el')
-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.
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."
+function, it is changed to a list of functions.
+
+Note: if you make a hook variable buffer-local, copy its value before
+you use `add-hook' to add to it. For example,
+
+ (make-local-variable 'foo-hook)
+ (if (boundp 'foo-hook)
+ (setq foo-hook (copy-sequence foo-hook)))
+ (add-hook 'foo-hook 'my-foo-function)"
(or (boundp hook) (set hook nil))
;; If the hook value is a single function, turn it into a list.
(let ((old (symbol-value hook)))