diff options
author | Richard M. Stallman <rms@gnu.org> | 1994-09-20 01:05:37 +0000 |
---|---|---|
committer | Richard M. Stallman <rms@gnu.org> | 1994-09-20 01:05:37 +0000 |
commit | c44d2ceda94f66937c938dd35311aa3a8c7b7ae0 (patch) | |
tree | 259a60379eea182c74bbed2f70bdd5a6d27f404c /lispref | |
parent | 2a598462ecee6f6fd7ce5f14b095ff0247f7692d (diff) | |
download | emacs-c44d2ceda94f66937c938dd35311aa3a8c7b7ae0.tar.gz |
*** empty log message ***
Diffstat (limited to 'lispref')
-rw-r--r-- | lispref/modes.texi | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/lispref/modes.texi b/lispref/modes.texi index fb71606f925..36c20ce8764 100644 --- a/lispref/modes.texi +++ b/lispref/modes.texi @@ -1381,3 +1381,21 @@ function goes at the end of the hook list and will be executed last. @defun remove-hook hook function This function removes @var{function} from the hook variable @var{hook}. @end defun + +If you make a hook variable buffer-local, copy its value before you use +@code{add-hook} or @code{remove-hook} to change it. For example, + +@example +(defun my-major-mode () + @dots{} + (make-local-variable 'foo-hook) + (if (boundp 'foo-hook) + (setq foo-hook (copy-sequence foo-hook))) + (add-hook 'foo-hook 'my-foo-function)" + @dots{} + ) +@end example + +Otherwise you may accidentally alter the list structure that forms part +of the global value of the hook variable. + |