]> git.eshelyaron.com Git - emacs.git/commitdiff
*** empty log message ***
authorRichard M. Stallman <rms@gnu.org>
Tue, 20 Sep 1994 01:05:37 +0000 (01:05 +0000)
committerRichard M. Stallman <rms@gnu.org>
Tue, 20 Sep 1994 01:05:37 +0000 (01:05 +0000)
lispref/modes.texi

index fb71606f925163c4a0024bc21c6de9cd9238e7ad..36c20ce87643be42397216f818dc7dddb5e51795 100644 (file)
@@ -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.
+