aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Stallman2020-01-01 18:18:44 -0500
committerEli Zaretskii2020-01-11 11:38:24 +0200
commit524441d6b3f1da298a048862d330258eebca1118 (patch)
treefc95d5c29247f1551a58520de036476009eaa22f
parent8addfa91c8e242d465828c7c8a7a1aa6b06060fc (diff)
downloademacs-524441d6b3f1da298a048862d330258eebca1118.tar.gz
emacs-524441d6b3f1da298a048862d330258eebca1118.zip
Improve wording in the ELisp manual
* doc/lispref/modes.texi (Setting Hooks): Improve and clarify wording. (Bug#38818)
-rw-r--r--doc/lispref/modes.texi17
1 files changed, 15 insertions, 2 deletions
diff --git a/doc/lispref/modes.texi b/doc/lispref/modes.texi
index 7354eb1b9f8..b52871ef70b 100644
--- a/doc/lispref/modes.texi
+++ b/doc/lispref/modes.texi
@@ -135,13 +135,26 @@ non-@code{nil} value, it returns that value; otherwise it returns
135@node Setting Hooks 135@node Setting Hooks
136@subsection Setting Hooks 136@subsection Setting Hooks
137 137
138 Here's an example that uses a mode hook to turn on Auto Fill mode when 138 Here's an example that adds a funtion to a mode hook to turn
139in Lisp Interaction mode: 139on Auto Fill mode when in Lisp Interaction mode:
140 140
141@example 141@example
142(add-hook 'lisp-interaction-mode-hook 'auto-fill-mode) 142(add-hook 'lisp-interaction-mode-hook 'auto-fill-mode)
143@end example 143@end example
144 144
145 The value of a hook variable should be a list of functions. You can
146manipulate that list using the normal Lisp facilities, but the modular
147way is to use the functions @code{add-hook} and @code{remove-hook},
148defined below. They take care to handle some unusual situations and
149avoid problems.
150
151 It works to put a @code{lambda}-expression function on a hook, but
152we recommend avoiding this because it can lead to confusion. If you
153add the same @code{lambda}-expression a second time but write it
154slightly differently, you will get two equivalent but distinct
155functions on the hook. If you then remove one of them, the other will
156still be on it.
157
145@defun add-hook hook function &optional depth local 158@defun add-hook hook function &optional depth local
146This function is the handy way to add function @var{function} to hook 159This function is the handy way to add function @var{function} to hook
147variable @var{hook}. You can use it for abnormal hooks as well as for 160variable @var{hook}. You can use it for abnormal hooks as well as for