diff options
| author | Luc Teirlinck | 2005-05-14 15:25:38 +0000 |
|---|---|---|
| committer | Luc Teirlinck | 2005-05-14 15:25:38 +0000 |
| commit | c71f84bd99f89004fed48064305b5f79ff13139f (patch) | |
| tree | f5a024c31679f5b2213ea1fa315233718f469861 | |
| parent | ce58b669c2cc3a44cef1d26bd08edd61941a747b (diff) | |
| download | emacs-c71f84bd99f89004fed48064305b5f79ff13139f.tar.gz emacs-c71f84bd99f89004fed48064305b5f79ff13139f.zip | |
(Hooks): Most minor modes run mode hooks too.
`add-hook' can handle void hooks or hooks whose value is a single function.
| -rw-r--r-- | lispref/modes.texi | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lispref/modes.texi b/lispref/modes.texi index c3247b4ca57..47d9ded1346 100644 --- a/lispref/modes.texi +++ b/lispref/modes.texi | |||
| @@ -2836,10 +2836,10 @@ a uniform way. | |||
| 2836 | Every major mode function is supposed to run a normal hook called the | 2836 | Every major mode function is supposed to run a normal hook called the |
| 2837 | @dfn{mode hook} as the last step of initialization. This makes it easy | 2837 | @dfn{mode hook} as the last step of initialization. This makes it easy |
| 2838 | for a user to customize the behavior of the mode, by overriding the | 2838 | for a user to customize the behavior of the mode, by overriding the |
| 2839 | buffer-local variable assignments already made by the mode. But hooks | 2839 | buffer-local variable assignments already made by the mode. Most |
| 2840 | are used in other contexts too. For example, the hook | 2840 | minor modes also run a mode hook at their end. But hooks are used in |
| 2841 | @code{suspend-hook} runs just before Emacs suspends itself | 2841 | other contexts too. For example, the hook @code{suspend-hook} runs |
| 2842 | (@pxref{Suspending Emacs}). | 2842 | just before Emacs suspends itself (@pxref{Suspending Emacs}). |
| 2843 | 2843 | ||
| 2844 | The recommended way to add a hook function to a normal hook is by | 2844 | The recommended way to add a hook function to a normal hook is by |
| 2845 | calling @code{add-hook} (see below). The hook functions may be any of | 2845 | calling @code{add-hook} (see below). The hook functions may be any of |
| @@ -2937,6 +2937,10 @@ executed first (barring another @code{add-hook} call). If the optional | |||
| 2937 | argument @var{append} is non-@code{nil}, the new hook function goes at | 2937 | argument @var{append} is non-@code{nil}, the new hook function goes at |
| 2938 | the end of the hook list and will be executed last. | 2938 | the end of the hook list and will be executed last. |
| 2939 | 2939 | ||
| 2940 | @code{add-hook} can handle the cases where @var{hook} is void or its | ||
| 2941 | value is a single function; it sets or changes the value to a list of | ||
| 2942 | functions. | ||
| 2943 | |||
| 2940 | If @var{local} is non-@code{nil}, that says to add @var{function} to | 2944 | If @var{local} is non-@code{nil}, that says to add @var{function} to |
| 2941 | the buffer-local hook list instead of to the global hook list. If | 2945 | the buffer-local hook list instead of to the global hook list. If |
| 2942 | needed, this makes the hook buffer-local and adds @code{t} to the | 2946 | needed, this makes the hook buffer-local and adds @code{t} to the |