summaryrefslogtreecommitdiff
path: root/doc/lispref/hooks.texi
blob: 95655324ab46a297606059f526bfa39e1a5302fa (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
@c -*-texinfo-*-
@c This is part of the GNU Emacs Lisp Reference Manual.
@c Copyright (C) 1990-1993, 1998, 2001-2012  Free Software Foundation, Inc.
@c See the file elisp.texi for copying conditions.
@setfilename ../../info/hooks
@node Standard Hooks, Index, Standard Keymaps, Top
@appendix Standard Hooks
@cindex standard hooks
@cindex hook variables, list of

The following is a list of hook variables that let you provide
functions to be called from within Emacs on suitable occasions.

Most of these variables have names ending with @samp{-hook}.  They are
@dfn{normal hooks}, run by means of @code{run-hooks}.  The value of such
a hook is a list of functions; the functions are called with no
arguments and their values are completely ignored.  The recommended way
to put a new function on such a hook is to call @code{add-hook}.
@xref{Hooks}, for more information about using hooks.

Every major mode defines a mode hook named
@samp{@var{modename}-mode-hook}.  The major mode command runs this
normal hook with @code{run-mode-hooks} as the very last thing it does.
@xref{Mode Hooks}.  Most minor modes have mode hooks too.  Mode hooks
are omitted in the list below.

The variables whose names end in @samp{-hooks} or @samp{-functions} are
usually @dfn{abnormal hooks}; their values are lists of functions, but
these functions are called in a special way (they are passed arguments,
or their values are used). The variables whose names end in
@samp{-function} have single functions as their values.

A special feature allows you to specify expressions to evaluate if and
when a file is loaded (@pxref{Hooks for Loading}).  That feature is
not exactly a hook, but does a similar job.

@c We need to xref to where each hook is documented or else document
@c it here.

@table @code
@item abbrev-expand-functions
@xref{Abbrev Expansion}.

@item activate-mark-hook
@xref{The Mark}.

@item after-change-functions
@xref{Change Hooks}.

@item after-change-major-mode-hook
@xref{Mode Hooks}.

@item after-init-hook
@xref{Init File}.

@item after-insert-file-functions
@xref{Format Conversion}.

@item after-make-frame-functions
@xref{Creating Frames}.

@item after-revert-hook
@xref{Reverting}.

@item after-save-hook
@xref{Saving Buffers}.

@item auto-fill-function
@xref{Auto Filling}.

@item auto-save-hook
@xref{Auto-Saving}.

@item before-change-functions
@xref{Change Hooks}.

@item before-hack-local-variables-hook
@xref{File Local Variables}.

@item before-init-hook
@xref{Init File}.

@item before-make-frame-hook
@xref{Creating Frames}.

@item before-revert-hook
@xref{Reverting}.

@item before-save-hook
@xref{Saving Buffers}.

@item blink-paren-function
@xref{Blinking}.

@item buffer-access-fontify-functions
@xref{Lazy Properties}.

@item calendar-initial-window-hook
@iftex
@inforef{Calendar Customizing,, emacs-xtra}.
@end iftex
@ifnottex
@xref{Calendar Customizing,,, emacs}.
@end ifnottex

@item calendar-load-hook
@iftex
@inforef{Calendar Customizing,, emacs-xtra}.
@end iftex
@ifnottex
@xref{Calendar Customizing,,, emacs}.
@end ifnottex

@item calendar-today-invisible-hook
@iftex
@inforef{Calendar Customizing,, emacs-xtra}.
@end iftex
@ifnottex
@xref{Calendar Customizing,,, emacs}.
@end ifnottex

@item calendar-today-visible-hook
@iftex
@inforef{Calendar Customizing,, emacs-xtra}.
@end iftex
@ifnottex
@xref{Calendar Customizing,,, emacs}.
@end ifnottex

@item change-major-mode-hook
@xref{Creating Buffer-Local}.

@item command-line-functions
@xref{Command-Line Arguments}.

@item comment-indent-function
@xref{Options for Comments,, Options Controlling Comments, emacs, the
GNU Emacs Manual}.

@item compilation-finish-functions
Functions to call when a compilation process finishes.

@item custom-define-hook
Hook called after defining each customize option.

@item deactivate-mark-hook
@xref{The Mark}.

@item delete-frame-functions
Functions to call when Emacs deletes a frame.  @xref{Deleting Frames}.

@item delete-terminal-functions
Functions to call when Emacs deletes a terminal.  @xref{Multiple
Terminals}.

@item desktop-after-read-hook
Normal hook run after a successful @code{desktop-read}.  May be used
to show a buffer list.  @xref{Saving Emacs Sessions,, Saving Emacs
Sessions, emacs, the GNU Emacs Manual}.

@item desktop-no-desktop-file-hook
Normal hook run when @code{desktop-read} can't find a desktop file.
May be used to show a dired buffer.  @xref{Saving Emacs Sessions,,
Saving Emacs Sessions, emacs, the GNU Emacs Manual}.

@item desktop-save-hook
Normal hook run before the desktop is saved in a desktop file.  This
is useful for truncating history lists, for example.  @xref{Saving
Emacs Sessions,, Saving Emacs Sessions, emacs, the GNU Emacs Manual}.

@item diary-hook
List of functions called after the display of the diary.  Can be used
for appointment notification.

@item diary-list-entries-hook
@iftex
@inforef{Fancy Diary Display,, emacs-xtra}.
@end iftex
@ifnottex
@xref{Fancy Diary Display,,, emacs}.
@end ifnottex

@item diary-mark-entries-hook
@iftex
@inforef{Fancy Diary Display,, emacs-xtra}.
@end iftex
@ifnottex
@xref{Fancy Diary Display,,, emacs}.
@end ifnottex

@item diary-nongregorian-listing-hook
@iftex
@inforef{Non-Gregorian Diary,, emacs-xtra}.
@end iftex
@ifnottex
@xref{Non-Gregorian Diary,,, emacs}.
@end ifnottex

@item diary-nongregorian-marking-hook
@iftex
@inforef{Non-Gregorian Diary,, emacs-xtra}.
@end iftex
@ifnottex
@xref{Non-Gregorian Diary,,, emacs}.
@end ifnottex

@item diary-print-entries-hook
@iftex
@inforef{Diary Display,, emacs-xtra}.
@end iftex
@ifnottex
@xref{Diary Display,,, emacs}.
@end ifnottex

@item disabled-command-function
@xref{Disabling Commands}.

@item echo-area-clear-hook
@xref{Echo Area Customization}.

@item emacs-startup-hook
@xref{Init File}.

@item find-file-hook
@xref{Visiting Functions}.

@item find-file-not-found-functions
@xref{Visiting Functions}.

@item first-change-hook
@xref{Change Hooks}.

@item font-lock-beginning-of-syntax-function
@xref{Syntactic Font Lock}.

@item font-lock-fontify-buffer-function
@xref{Other Font Lock Variables}.

@item font-lock-fontify-region-function
@xref{Other Font Lock Variables}.

@item font-lock-mark-block-function
@xref{Other Font Lock Variables}.

@item font-lock-syntactic-face-function
@xref{Syntactic Font Lock}.

@item font-lock-unfontify-buffer-function
@xref{Other Font Lock Variables}.

@item hack-local-variables-hook
@xref{File Local Variables}.

@item font-lock-unfontify-region-function
@xref{Other Font Lock Variables}.

@item kbd-macro-termination-hook
@xref{Keyboard Macros}.

@item kill-buffer-hook
@xref{Killing Buffers}.

@item kill-buffer-query-functions
@xref{Killing Buffers}.

@item kill-emacs-hook
@xref{Killing Emacs}.

@item kill-emacs-query-functions
@xref{Killing Emacs}.

@item lisp-indent-function

@item mail-setup-hook
@xref{Mail Mode Misc,, Mail Mode Miscellany, emacs, the GNU Emacs
Manual}.

@item menu-bar-update-hook
@xref{Menu Bar}.

@item minibuffer-setup-hook
@xref{Minibuffer Misc}.

@item minibuffer-exit-hook
@xref{Minibuffer Misc}.

@item mouse-position-function
@xref{Mouse Position}.

@item occur-hook

@item post-command-hook
@xref{Command Overview}.

@item pre-command-hook
@xref{Command Overview}.

@item resume-tty-functions
@xref{Suspending Emacs}.

@item scheme-indent-function

@item suspend-hook
@xref{Suspending Emacs}.

@item suspend-resume-hook
@xref{Suspending Emacs}.

@item suspend-tty-functions
@xref{Suspending Emacs}.

@item temp-buffer-setup-hook
@xref{Temporary Displays}.

@item temp-buffer-show-function
@xref{Temporary Displays}.

@item temp-buffer-show-hook
@xref{Temporary Displays}.

@item term-setup-hook
@xref{Terminal-Specific}.

@item window-configuration-change-hook
@xref{Window Hooks}.

@item window-scroll-functions
@xref{Window Hooks}.

@item window-setup-hook
@xref{Window Systems}.

@item window-size-change-functions
@xref{Window Hooks}.

@item write-contents-functions
@xref{Saving Buffers}.

@item write-file-functions
@xref{Saving Buffers}.

@item write-region-annotate-functions
@xref{Format Conversion}.
@end table