File tree Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -135,13 +135,26 @@ non-@code{nil} value, it returns that value; otherwise it returns
135
135
@node Setting Hooks
136
136
@subsection Setting Hooks
137
137
138
- Here's an example that uses a mode hook to turn on Auto Fill mode when
139
- in Lisp Interaction mode:
138
+ Here's an example that adds a funtion to a mode hook to turn
139
+ on Auto Fill mode when in Lisp Interaction mode:
140
140
141
141
@example
142
142
(add-hook 'lisp-interaction-mode-hook 'auto-fill-mode)
143
143
@end example
144
144
145
+ The value of a hook variable should be a list of functions. You can
146
+ manipulate that list using the normal Lisp facilities, but the modular
147
+ way is to use the functions @code {add-hook } and @code {remove-hook },
148
+ defined below. They take care to handle some unusual situations and
149
+ avoid problems.
150
+
151
+ It works to put a @code {lambda }-expression function on a hook, but
152
+ we recommend avoiding this because it can lead to confusion. If you
153
+ add the same @code {lambda }-expression a second time but write it
154
+ slightly differently, you will get two equivalent but distinct
155
+ functions on the hook. If you then remove one of them, the other will
156
+ still be on it.
157
+
145
158
@defun add-hook hook function &optional depth local
146
159
This function is the handy way to add function @var {function } to hook
147
160
variable @var {hook }. You can use it for abnormal hooks as well as for
You can’t perform that action at this time.
0 commit comments