diff options
| author | Richard Stallman | 2020-01-01 18:18:44 -0500 |
|---|---|---|
| committer | Eli Zaretskii | 2020-01-11 11:38:24 +0200 |
| commit | 524441d6b3f1da298a048862d330258eebca1118 (patch) | |
| tree | fc95d5c29247f1551a58520de036476009eaa22f | |
| parent | 8addfa91c8e242d465828c7c8a7a1aa6b06060fc (diff) | |
| download | emacs-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.texi | 17 |
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 |
| 139 | in Lisp Interaction mode: | 139 | on 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 | ||
| 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 | @defun add-hook hook function &optional depth local | 158 | @defun add-hook hook function &optional depth local |
| 146 | This function is the handy way to add function @var{function} to hook | 159 | This function is the handy way to add function @var{function} to hook |
| 147 | variable @var{hook}. You can use it for abnormal hooks as well as for | 160 | variable @var{hook}. You can use it for abnormal hooks as well as for |