[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/doc/lispref/modes.texi,v
From: |
Richard M. Stallman |
Subject: |
[Emacs-diffs] Changes to emacs/doc/lispref/modes.texi,v |
Date: |
Fri, 25 Jan 2008 23:04:06 +0000 |
CVSROOT: /cvsroot/emacs
Module name: emacs
Changes by: Richard M. Stallman <rms> 08/01/25 23:04:06
Index: modes.texi
===================================================================
RCS file: /cvsroot/emacs/emacs/doc/lispref/modes.texi,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- modes.texi 8 Jan 2008 20:45:49 -0000 1.3
+++ modes.texi 25 Jan 2008 23:04:06 -0000 1.4
@@ -77,15 +77,16 @@
@samp{-hooks}. If the variable's name ends in @samp{-function}, then
its value is just a single function, not a list of functions.
- Here's an example that uses a mode hook to turn on Auto Fill mode when
-in Lisp Interaction mode:
address@hidden
+* Running Hooks:: How to run a hook.
+* Setting Hooks:: How to put functions on a hook, or remove them.
address@hidden menu
address@hidden
-(add-hook 'lisp-interaction-mode-hook 'turn-on-auto-fill)
address@hidden example
address@hidden Running Hooks
address@hidden Running Hooks
- At the appropriate time, Emacs uses the @code{run-hooks} function to
-run particular hooks.
+ At the appropriate times, Emacs uses the @code{run-hooks} function
+and the other functions below to run particular hooks.
@defun run-hooks &rest hookvars
This function takes one or more normal hook variable names as
@@ -125,6 +126,16 @@
@code{nil}, it returns @code{nil} as well.
@end defun
address@hidden Setting Hooks
address@hidden Setting Hooks
+
+ Here's an example that uses a mode hook to turn on Auto Fill mode when
+in Lisp Interaction mode:
+
address@hidden
+(add-hook 'lisp-interaction-mode-hook 'turn-on-auto-fill)
address@hidden example
+
@defun add-hook hook function &optional append local
This function is the handy way to add function @var{function} to hook
variable @var{hook}. You can use it for abnormal hooks as well as for
@@ -141,6 +152,11 @@
If @var{function} is already present in @var{hook} (comparing using
@code{equal}), then @code{add-hook} does not add it a second time.
+If @var{function} has a address@hidden property
address@hidden, then @code{kill-all-local-variables} (or
+changing major modes) won't delete it from the hook variable's local
+value.
+
It is best to design your hook functions so that the order in which they
are executed does not matter. Any dependence on the order is ``asking
for trouble.'' However, the order is predictable: normally,