]> code.delx.au - gnu-emacs/blob - doc/lispref/hooks.texi
* doc/lispref/hooks.texi (Standard Hooks): Add prog-mode-hook.
[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-2012 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-after-body-hook
131 @xref{Mode Hooks}.
132
133 @item change-major-mode-hook
134 @xref{Creating Buffer-Local}.
135
136 @item command-line-functions
137 @xref{Command-Line Arguments}.
138
139 @item comment-indent-function
140 @xref{Options for Comments,, Options Controlling Comments, emacs, the
141 GNU Emacs Manual}.
142
143 @item compilation-finish-functions
144 Functions to call when a compilation process finishes.
145
146 @item custom-define-hook
147 Hook called after defining each customize option.
148
149 @item deactivate-mark-hook
150 @xref{The Mark}.
151
152 @item delete-frame-functions
153 Functions to call when Emacs deletes a frame. @xref{Deleting Frames}.
154
155 @item delete-terminal-functions
156 Functions to call when Emacs deletes a terminal. @xref{Multiple
157 Terminals}.
158
159 @item desktop-after-read-hook
160 Normal hook run after a successful @code{desktop-read}. May be used
161 to show a buffer list. @xref{Saving Emacs Sessions,, Saving Emacs
162 Sessions, emacs, the GNU Emacs Manual}.
163
164 @item desktop-no-desktop-file-hook
165 Normal hook run when @code{desktop-read} can't find a desktop file.
166 May be used to show a dired buffer. @xref{Saving Emacs Sessions,,
167 Saving Emacs Sessions, emacs, the GNU Emacs Manual}.
168
169 @item desktop-save-hook
170 Normal hook run before the desktop is saved in a desktop file. This
171 is useful for truncating history lists, for example. @xref{Saving
172 Emacs Sessions,, Saving Emacs Sessions, emacs, the GNU Emacs Manual}.
173
174 @item diary-hook
175 List of functions called after the display of the diary. Can be used
176 for appointment notification.
177
178 @item diary-list-entries-hook
179 @iftex
180 @inforef{Fancy Diary Display,, emacs-xtra}.
181 @end iftex
182 @ifnottex
183 @xref{Fancy Diary Display,,, emacs}.
184 @end ifnottex
185
186 @item diary-mark-entries-hook
187 @iftex
188 @inforef{Fancy Diary Display,, emacs-xtra}.
189 @end iftex
190 @ifnottex
191 @xref{Fancy Diary Display,,, emacs}.
192 @end ifnottex
193
194 @item diary-nongregorian-listing-hook
195 @iftex
196 @inforef{Non-Gregorian Diary,, emacs-xtra}.
197 @end iftex
198 @ifnottex
199 @xref{Non-Gregorian Diary,,, emacs}.
200 @end ifnottex
201
202 @item diary-nongregorian-marking-hook
203 @iftex
204 @inforef{Non-Gregorian Diary,, emacs-xtra}.
205 @end iftex
206 @ifnottex
207 @xref{Non-Gregorian Diary,,, emacs}.
208 @end ifnottex
209
210 @item diary-print-entries-hook
211 @iftex
212 @inforef{Diary Display,, emacs-xtra}.
213 @end iftex
214 @ifnottex
215 @xref{Diary Display,,, emacs}.
216 @end ifnottex
217
218 @item disabled-command-function
219 @xref{Disabling Commands}.
220
221 @item echo-area-clear-hook
222 @xref{Echo Area Customization}.
223
224 @item emacs-startup-hook
225 @xref{Init File}.
226
227 @item find-file-hook
228 @xref{Visiting Functions}.
229
230 @item find-file-not-found-functions
231 @xref{Visiting Functions}.
232
233 @item first-change-hook
234 @xref{Change Hooks}.
235
236 @item font-lock-beginning-of-syntax-function
237 @xref{Syntactic Font Lock}.
238
239 @item font-lock-fontify-buffer-function
240 @xref{Other Font Lock Variables}.
241
242 @item font-lock-fontify-region-function
243 @xref{Other Font Lock Variables}.
244
245 @item font-lock-mark-block-function
246 @xref{Other Font Lock Variables}.
247
248 @item font-lock-syntactic-face-function
249 @xref{Syntactic Font Lock}.
250
251 @item font-lock-unfontify-buffer-function
252 @xref{Other Font Lock Variables}.
253
254 @item hack-local-variables-hook
255 @xref{File Local Variables}.
256
257 @item font-lock-unfontify-region-function
258 @xref{Other Font Lock Variables}.
259
260 @item kbd-macro-termination-hook
261 @xref{Keyboard Macros}.
262
263 @item kill-buffer-hook
264 @xref{Killing Buffers}.
265
266 @item kill-buffer-query-functions
267 @xref{Killing Buffers}.
268
269 @item kill-emacs-hook
270 @xref{Killing Emacs}.
271
272 @item kill-emacs-query-functions
273 @xref{Killing Emacs}.
274
275 @item lisp-indent-function
276
277 @item mail-setup-hook
278 @xref{Mail Mode Misc,, Mail Mode Miscellany, emacs, the GNU Emacs
279 Manual}.
280
281 @item menu-bar-update-hook
282 @xref{Menu Bar}.
283
284 @item minibuffer-setup-hook
285 @xref{Minibuffer Misc}.
286
287 @item minibuffer-exit-hook
288 @xref{Minibuffer Misc}.
289
290 @item mouse-position-function
291 @xref{Mouse Position}.
292
293 @item occur-hook
294
295 @item post-command-hook
296 @xref{Command Overview}.
297
298 @item pre-command-hook
299 @xref{Command Overview}.
300
301 @item prog-mode-hook
302 @xref{Basic Major Modes}.
303
304 @item resume-tty-functions
305 @xref{Suspending Emacs}.
306
307 @item scheme-indent-function
308
309 @item suspend-hook
310 @xref{Suspending Emacs}.
311
312 @item suspend-resume-hook
313 @xref{Suspending Emacs}.
314
315 @item suspend-tty-functions
316 @xref{Suspending Emacs}.
317
318 @item temp-buffer-setup-hook
319 @xref{Temporary Displays}.
320
321 @item temp-buffer-show-function
322 @xref{Temporary Displays}.
323
324 @item temp-buffer-show-hook
325 @xref{Temporary Displays}.
326
327 @item term-setup-hook
328 @xref{Terminal-Specific}.
329
330 @item window-configuration-change-hook
331 @xref{Window Hooks}.
332
333 @item window-scroll-functions
334 @xref{Window Hooks}.
335
336 @item window-setup-hook
337 @xref{Window Systems}.
338
339 @item window-size-change-functions
340 @xref{Window Hooks}.
341
342 @item write-contents-functions
343 @xref{Saving Buffers}.
344
345 @item write-file-functions
346 @xref{Saving Buffers}.
347
348 @item write-region-annotate-functions
349 @xref{Format Conversion}.
350 @end table