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 | 7d2088bf64722dff6dcf23c1e8ef2388a12c83d6 (patch) | |
tree | 377379891f0acbfba60f15259538c9eed1af3d2e /lispref/modes.texi | |
parent | 95de4f718ea6f8397eb0037695e769016a145e4e (diff) | |
download | emacs-7d2088bf64722dff6dcf23c1e8ef2388a12c83d6.tar.gz |
*** empty log message ***
Diffstat (limited to 'lispref/modes.texi')
-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. + |