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