diff options
| author | Richard M. Stallman | 1994-09-20 00:59:24 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1994-09-20 00:59:24 +0000 |
| commit | 2a598462ecee6f6fd7ce5f14b095ff0247f7692d (patch) | |
| tree | 8876f092090c1a6fdb65540323a3e011c028d451 | |
| parent | e08455275a9859ac679ecc7dbdf89f397ad68d6b (diff) | |
| download | emacs-2a598462ecee6f6fd7ce5f14b095ff0247f7692d.tar.gz emacs-2a598462ecee6f6fd7ce5f14b095ff0247f7692d.zip | |
(add-hook): Doc fix.
| -rw-r--r-- | lisp/subr.el | 10 |
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 | ||
| 552 | HOOK should be a symbol, and FUNCTION may be any valid function. If | 552 | HOOK should be a symbol, and FUNCTION may be any valid function. If |
| 553 | HOOK is void, it is first set to nil. If HOOK's value is a single | 553 | HOOK is void, it is first set to nil. If HOOK's value is a single |
| 554 | function, it is changed to a list of functions." | 554 | function, it is changed to a list of functions. |
| 555 | |||
| 556 | Note: if you make a hook variable buffer-local, copy its value before | ||
| 557 | you 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))) |