changeset 8929:d7dc9a5b8c70

*** empty log message ***
author Richard M. Stallman <rms@gnu.org>
date Tue, 20 Sep 1994 01:05:37 +0000
parents 0ea4cc4ca339
children 166ebab32ffa
files lispref/modes.texi
diffstat 1 files changed, 18 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/lispref/modes.texi	Tue Sep 20 00:59:24 1994 +0000
+++ b/lispref/modes.texi	Tue Sep 20 01:05:37 1994 +0000
@@ -1381,3 +1381,21 @@
 @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.
+