]> code.delx.au - gnu-emacs/blob - doc/lispref/hooks.texi
Convert consecutive FSF copyright years to ranges.
[gnu-emacs] / doc / lispref / hooks.texi
1 @c -*-texinfo-*-
2 @c This is part of the GNU Emacs Lisp Reference Manual.
3 @c Copyright (C) 1990-1993, 1998, 2001-2011 Free Software Foundation, Inc.
4 @c See the file elisp.texi for copying conditions.
5 @setfilename ../../info/hooks
6 @node Standard Hooks, Index, Standard Keymaps, Top
7 @appendix Standard Hooks
8 @cindex standard hooks
9 @cindex hook variables, list of
10
11 The following is a list of hook variables that let you provide
12 functions to be called from within Emacs on suitable occasions.
13
14 Most of these variables have names ending with @samp{-hook}. They are
15 @dfn{normal hooks}, run by means of @code{run-hooks}. The value of such
16 a hook is a list of functions; the functions are called with no
17 arguments and their values are completely ignored. The recommended way
18 to put a new function on such a hook is to call @code{add-hook}.
19 @xref{Hooks}, for more information about using hooks.
20
21 Every major mode defines a mode hook named
22 @samp{@var{modename}-mode-hook}. The major mode command runs this
23 normal hook with @code{run-mode-hooks} as the very last thing it does.
24 @xref{Mode Hooks}. Most minor modes have mode hooks too. Mode hooks
25 are omitted in the list below.
26
27 The variables whose names end in @samp{-hooks} or @samp{-functions} are
28 usually @dfn{abnormal hooks}; their values are lists of functions, but
29 these functions are called in a special way (they are passed arguments,
30 or their values are used). The variables whose names end in
31 @samp{-function} have single functions as their values.
32
33 A special feature allows you to specify expressions to evaluate if and
34 when a file is loaded (@pxref{Hooks for Loading}). That feature is
35 not exactly a hook, but does a similar job.
36
37 @c We need to xref to where each hook is documented or else document
38 @c it here.
39
40 @table @code
41 @item abbrev-expand-functions
42 @xref{Abbrev Expansion}.
43
44 @item activate-mark-hook
45 @xref{The Mark}.
46
47 @item after-change-functions
48 @xref{Change Hooks}.
49
50 @item after-change-major-mode-hook
51 @xref{Mode Hooks}.
52
53 @item after-init-hook
54 @xref{Init File}.
55
56 @item after-insert-file-functions
57 @xref{Format Conversion}.
58
59 @item after-make-frame-functions
60 @xref{Creating Frames}.
61
62 @item after-revert-hook
63 @xref{Reverting}.
64
65 @item after-save-hook
66 @xref{Saving Buffers}.
67
68 @item auto-fill-function
69 @xref{Auto Filling}.
70
71 @item auto-save-hook
72 @xref{Auto-Saving}.
73
74 @item before-change-functions
75 @xref{Change Hooks}.
76
77 @item before-hack-local-variables-hook
78 @xref{File Local Variables}.
79
80 @item before-init-hook
81 @xref{Init File}.
82
83 @item before-make-frame-hook
84 @xref{Creating Frames}.
85
86 @item before-revert-hook
87 @xref{Reverting}.
88
89 @item before-save-hook
90 @xref{Saving Buffers}.
91
92 @item blink-paren-function
93 @xref{Blinking}.
94
95 @item buffer-access-fontify-functions
96 @xref{Lazy Properties}.
97
98 @item calendar-initial-window-hook
99 @iftex
100 @inforef{Calendar Customizing,, emacs-xtra}.
101 @end iftex
102 @ifnottex
103 @xref{Calendar Customizing,,, emacs}.
104 @end ifnottex
105
106 @item calendar-load-hook
107 @iftex
108 @inforef{Calendar Customizing,, emacs-xtra}.
109 @end iftex
110 @ifnottex
111 @xref{Calendar Customizing,,, emacs}.
112 @end ifnottex
113
114 @item calendar-today-invisible-hook
115 @iftex
116 @inforef{Calendar Customizing,, emacs-xtra}.
117 @end iftex
118 @ifnottex
119 @xref{Calendar Customizing,,, emacs}.
120 @end ifnottex
121
122 @item calendar-today-visible-hook
123 @iftex
124 @inforef{Calendar Customizing,, emacs-xtra}.
125 @end iftex
126 @ifnottex
127 @xref{Calendar Customizing,,, emacs}.
128 @end ifnottex
129
130 @item change-major-mode-hook
131 @xref{Creating Buffer-Local}.
132
133 @item command-line-functions
134 @xref{Command-Line Arguments}.
135
136 @item comment-indent-function
137 @xref{Options for Comments,, Options Controlling Comments, emacs, the
138 GNU Emacs Manual}.
139
140 @item compilation-finish-functions
141 Functions to call when a compilation process finishes.
142
143 @item custom-define-hook
144 Hook called after defining each customize option.
145
146 @item deactivate-mark-hook
147 @xref{The Mark}.
148
149 @item delete-frame-functions
150 Functions to call when Emacs deletes a frame. @xref{Deleting Frames}.
151
152 @item delete-terminal-functions
153 Functions to call when Emacs deletes a terminal. @xref{Multiple
154 Terminals}.
155
156 @item desktop-after-read-hook
157 Normal hook run after a successful @code{desktop-read}. May be used
158 to show a buffer list. @xref{Saving Emacs Sessions,, Saving Emacs
159 Sessions, emacs, the GNU Emacs Manual}.
160
161 @item desktop-no-desktop-file-hook
162 Normal hook run when @code{desktop-read} can't find a desktop file.
163 May be used to show a dired buffer. @xref{Saving Emacs Sessions,,
164 Saving Emacs Sessions, emacs, the GNU Emacs Manual}.
165
166 @item desktop-save-hook
167 Normal hook run before the desktop is saved in a desktop file. This
168 is useful for truncating history lists, for example. @xref{Saving
169 Emacs Sessions,, Saving Emacs Sessions, emacs, the GNU Emacs Manual}.
170
171 @item diary-hook
172 List of functions called after the display of the diary. Can be used
173 for appointment notification.
174
175 @item diary-list-entries-hook
176 @iftex
177 @inforef{Fancy Diary Display,, emacs-xtra}.
178 @end iftex
179 @ifnottex
180 @xref{Fancy Diary Display,,, emacs}.
181 @end ifnottex
182
183 @item diary-mark-entries-hook
184 @iftex
185 @inforef{Fancy Diary Display,, emacs-xtra}.
186 @end iftex
187 @ifnottex
188 @xref{Fancy Diary Display,,, emacs}.
189 @end ifnottex
190
191 @item diary-nongregorian-listing-hook
192 @iftex
193 @inforef{Non-Gregorian Diary,, emacs-xtra}.
194 @end iftex
195 @ifnottex
196 @xref{Non-Gregorian Diary,,, emacs}.
197 @end ifnottex
198
199 @item diary-nongregorian-marking-hook
200 @iftex
201 @inforef{Non-Gregorian Diary,, emacs-xtra}.
202 @end iftex
203 @ifnottex
204 @xref{Non-Gregorian Diary,,, emacs}.
205 @end ifnottex
206
207 @item diary-print-entries-hook
208 @iftex
209 @inforef{Diary Display,, emacs-xtra}.
210 @end iftex
211 @ifnottex
212 @xref{Diary Display,,, emacs}.
213 @end ifnottex
214
215 @item disabled-command-function
216 @xref{Disabling Commands}.
217
218 @item echo-area-clear-hook
219 @xref{Echo Area Customization}.
220
221 @item emacs-startup-hook
222 @xref{Init File}.
223
224 @item find-file-hook
225 @xref{Visiting Functions}.
226
227 @item find-file-not-found-functions
228 @xref{Visiting Functions}.
229
230 @item first-change-hook
231 @xref{Change Hooks}.
232
233 @item font-lock-beginning-of-syntax-function
234 @xref{Syntactic Font Lock}.
235
236 @item font-lock-fontify-buffer-function
237 @xref{Other Font Lock Variables}.
238
239 @item font-lock-fontify-region-function
240 @xref{Other Font Lock Variables}.
241
242 @item font-lock-mark-block-function
243 @xref{Other Font Lock Variables}.
244
245 @item font-lock-syntactic-face-function
246 @xref{Syntactic Font Lock}.
247
248 @item font-lock-unfontify-buffer-function
249 @xref{Other Font Lock Variables}.
250
251 @item hack-local-variables-hook
252 @xref{File Local Variables}.
253
254 @item font-lock-unfontify-region-function
255 @xref{Other Font Lock Variables}.
256
257 @item kbd-macro-termination-hook
258 @xref{Keyboard Macros}.
259
260 @item kill-buffer-hook
261 @xref{Killing Buffers}.
262
263 @item kill-buffer-query-functions
264 @xref{Killing Buffers}.
265
266 @item kill-emacs-hook
267 @xref{Killing Emacs}.
268
269 @item kill-emacs-query-functions
270 @xref{Killing Emacs}.
271
272 @item lisp-indent-function
273
274 @item mail-setup-hook
275 @xref{Mail Mode Misc,, Mail Mode Miscellany, emacs, the GNU Emacs
276 Manual}.
277
278 @item menu-bar-update-hook
279 @xref{Menu Bar}.
280
281 @item minibuffer-setup-hook
282 @xref{Minibuffer Misc}.
283
284 @item minibuffer-exit-hook
285 @xref{Minibuffer Misc}.
286
287 @item mouse-position-function
288 @xref{Mouse Position}.
289
290 @item occur-hook
291
292 @item post-command-hook
293 @xref{Command Overview}.
294
295 @item pre-command-hook
296 @xref{Command Overview}.
297
298 @item resume-tty-functions
299 @xref{Suspending Emacs}.
300
301 @item scheme-indent-function
302
303 @item suspend-hook
304 @xref{Suspending Emacs}.
305
306 @item suspend-resume-hook
307 @xref{Suspending Emacs}.
308
309 @item suspend-tty-functions
310 @xref{Suspending Emacs}.
311
312 @item temp-buffer-setup-hook
313 @xref{Temporary Displays}.
314
315 @item temp-buffer-show-function
316 @xref{Temporary Displays}.
317
318 @item temp-buffer-show-hook
319 @xref{Temporary Displays}.
320
321 @item term-setup-hook
322 @xref{Terminal-Specific}.
323
324 @item window-configuration-change-hook
325 @xref{Window Hooks}.
326
327 @item window-scroll-functions
328 @xref{Window Hooks}.
329
330 @item window-setup-hook
331 @xref{Window Systems}.
332
333 @item window-size-change-functions
334 @xref{Window Hooks}.
335
336 @item write-contents-functions
337 @xref{Saving Buffers}.
338
339 @item write-file-functions
340 @xref{Saving Buffers}.
341
342 @item write-region-annotate-functions
343 @xref{Format Conversion}.
344 @end table