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
9 @cindex hook variables, list of
11 The following is a list of hook variables that let you provide
12 functions to be called from within Emacs on suitable occasions.
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.
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.
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.
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.
37 @c We need to xref to where each hook is documented or else document
41 @item abbrev-expand-functions
42 @xref{Abbrev Expansion}.
44 @item activate-mark-hook
47 @item after-change-functions
50 @item after-change-major-mode-hook
56 @item after-insert-file-functions
57 @xref{Format Conversion}.
59 @item after-make-frame-functions
60 @xref{Creating Frames}.
62 @item after-revert-hook
66 @xref{Saving Buffers}.
68 @item auto-fill-function
74 @item before-change-functions
77 @item before-hack-local-variables-hook
78 @xref{File Local Variables}.
80 @item before-init-hook
83 @item before-make-frame-hook
84 @xref{Creating Frames}.
86 @item before-revert-hook
89 @item before-save-hook
90 @xref{Saving Buffers}.
92 @item blink-paren-function
95 @item buffer-access-fontify-functions
96 @xref{Lazy Properties}.
98 @item calendar-initial-window-hook
100 @inforef{Calendar Customizing,, emacs-xtra}.
103 @xref{Calendar Customizing,,, emacs}.
106 @item calendar-load-hook
108 @inforef{Calendar Customizing,, emacs-xtra}.
111 @xref{Calendar Customizing,,, emacs}.
114 @item calendar-today-invisible-hook
116 @inforef{Calendar Customizing,, emacs-xtra}.
119 @xref{Calendar Customizing,,, emacs}.
122 @item calendar-today-visible-hook
124 @inforef{Calendar Customizing,, emacs-xtra}.
127 @xref{Calendar Customizing,,, emacs}.
130 @item change-major-mode-hook
131 @xref{Creating Buffer-Local}.
133 @item command-line-functions
134 @xref{Command-Line Arguments}.
136 @item comment-indent-function
137 @xref{Options for Comments,, Options Controlling Comments, emacs, the
140 @item compilation-finish-functions
141 Functions to call when a compilation process finishes.
143 @item custom-define-hook
144 Hook called after defining each customize option.
146 @item deactivate-mark-hook
149 @item delete-frame-functions
150 Functions to call when Emacs deletes a frame. @xref{Deleting Frames}.
152 @item delete-terminal-functions
153 Functions to call when Emacs deletes a terminal. @xref{Multiple
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}.
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}.
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}.
172 List of functions called after the display of the diary. Can be used
173 for appointment notification.
175 @item diary-list-entries-hook
177 @inforef{Fancy Diary Display,, emacs-xtra}.
180 @xref{Fancy Diary Display,,, emacs}.
183 @item diary-mark-entries-hook
185 @inforef{Fancy Diary Display,, emacs-xtra}.
188 @xref{Fancy Diary Display,,, emacs}.
191 @item diary-nongregorian-listing-hook
193 @inforef{Non-Gregorian Diary,, emacs-xtra}.
196 @xref{Non-Gregorian Diary,,, emacs}.
199 @item diary-nongregorian-marking-hook
201 @inforef{Non-Gregorian Diary,, emacs-xtra}.
204 @xref{Non-Gregorian Diary,,, emacs}.
207 @item diary-print-entries-hook
209 @inforef{Diary Display,, emacs-xtra}.
212 @xref{Diary Display,,, emacs}.
215 @item disabled-command-function
216 @xref{Disabling Commands}.
218 @item echo-area-clear-hook
219 @xref{Echo Area Customization}.
221 @item emacs-startup-hook
225 @xref{Visiting Functions}.
227 @item find-file-not-found-functions
228 @xref{Visiting Functions}.
230 @item first-change-hook
233 @item font-lock-beginning-of-syntax-function
234 @xref{Syntactic Font Lock}.
236 @item font-lock-fontify-buffer-function
237 @xref{Other Font Lock Variables}.
239 @item font-lock-fontify-region-function
240 @xref{Other Font Lock Variables}.
242 @item font-lock-mark-block-function
243 @xref{Other Font Lock Variables}.
245 @item font-lock-syntactic-face-function
246 @xref{Syntactic Font Lock}.
248 @item font-lock-unfontify-buffer-function
249 @xref{Other Font Lock Variables}.
251 @item hack-local-variables-hook
252 @xref{File Local Variables}.
254 @item font-lock-unfontify-region-function
255 @xref{Other Font Lock Variables}.
257 @item kbd-macro-termination-hook
258 @xref{Keyboard Macros}.
260 @item kill-buffer-hook
261 @xref{Killing Buffers}.
263 @item kill-buffer-query-functions
264 @xref{Killing Buffers}.
266 @item kill-emacs-hook
267 @xref{Killing Emacs}.
269 @item kill-emacs-query-functions
270 @xref{Killing Emacs}.
272 @item lisp-indent-function
274 @item mail-setup-hook
275 @xref{Mail Mode Misc,, Mail Mode Miscellany, emacs, the GNU Emacs
278 @item menu-bar-update-hook
281 @item minibuffer-setup-hook
282 @xref{Minibuffer Misc}.
284 @item minibuffer-exit-hook
285 @xref{Minibuffer Misc}.
287 @item mouse-position-function
288 @xref{Mouse Position}.
292 @item post-command-hook
293 @xref{Command Overview}.
295 @item pre-command-hook
296 @xref{Command Overview}.
298 @item resume-tty-functions
299 @xref{Suspending Emacs}.
301 @item scheme-indent-function
304 @xref{Suspending Emacs}.
306 @item suspend-resume-hook
307 @xref{Suspending Emacs}.
309 @item suspend-tty-functions
310 @xref{Suspending Emacs}.
312 @item temp-buffer-setup-hook
313 @xref{Temporary Displays}.
315 @item temp-buffer-show-function
316 @xref{Temporary Displays}.
318 @item temp-buffer-show-hook
319 @xref{Temporary Displays}.
321 @item term-setup-hook
322 @xref{Terminal-Specific}.
324 @item window-configuration-change-hook
327 @item window-scroll-functions
330 @item window-setup-hook
331 @xref{Window Systems}.
333 @item window-size-change-functions
336 @item write-contents-functions
337 @xref{Saving Buffers}.
339 @item write-file-functions
340 @xref{Saving Buffers}.
342 @item write-region-annotate-functions
343 @xref{Format Conversion}.