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 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
10 @cindex hook variables, list of
12 The following is a list of hook variables that let you provide
13 functions to be called from within Emacs on suitable occasions.
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.
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.
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.
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.
38 @c We need to xref to where each hook is documented or else document
42 @item abbrev-expand-functions
43 @xref{Abbrev Expansion}.
45 @item activate-mark-hook
48 @item after-change-functions
51 @item after-change-major-mode-hook
57 @item after-insert-file-functions
58 @xref{Format Conversion}.
60 @item after-make-frame-functions
61 @xref{Creating Frames}.
63 @item after-revert-hook
67 @xref{Saving Buffers}.
69 @item auto-fill-function
75 @item before-change-functions
78 @item before-hack-local-variables-hook
79 @xref{File Local Variables}.
81 @item before-init-hook
84 @item before-make-frame-hook
85 @xref{Creating Frames}.
87 @item before-revert-hook
90 @item before-save-hook
91 @xref{Saving Buffers}.
93 @item blink-paren-function
96 @item buffer-access-fontify-functions
97 @xref{Lazy Properties}.
99 @item calendar-initial-window-hook
101 @inforef{Calendar Customizing,, emacs-xtra}.
104 @xref{Calendar Customizing,,, emacs}.
107 @item calendar-load-hook
109 @inforef{Calendar Customizing,, emacs-xtra}.
112 @xref{Calendar Customizing,,, emacs}.
115 @item calendar-today-invisible-hook
117 @inforef{Calendar Customizing,, emacs-xtra}.
120 @xref{Calendar Customizing,,, emacs}.
123 @item calendar-today-visible-hook
125 @inforef{Calendar Customizing,, emacs-xtra}.
128 @xref{Calendar Customizing,,, emacs}.
131 @item change-major-mode-hook
132 @xref{Creating Buffer-Local}.
134 @item command-line-functions
135 @xref{Command-Line Arguments}.
137 @item comment-indent-function
138 @xref{Options for Comments,, Options Controlling Comments, emacs, the
141 @item compilation-finish-functions
142 Functions to call when a compilation process finishes.
144 @item custom-define-hook
145 Hook called after defining each customize option.
147 @item deactivate-mark-hook
150 @item delete-frame-functions
151 Functions to call when Emacs deletes a frame. @xref{Deleting Frames}.
153 @item delete-terminal-functions
154 Functions to call when Emacs deletes a terminal. @xref{Multiple
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}.
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}.
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}.
173 List of functions called after the display of the diary. Can be used
174 for appointment notification.
176 @item diary-list-entries-hook
178 @inforef{Fancy Diary Display,, emacs-xtra}.
181 @xref{Fancy Diary Display,,, emacs}.
184 @item diary-mark-entries-hook
186 @inforef{Fancy Diary Display,, emacs-xtra}.
189 @xref{Fancy Diary Display,,, emacs}.
192 @item diary-nongregorian-listing-hook
194 @inforef{Non-Gregorian Diary,, emacs-xtra}.
197 @xref{Non-Gregorian Diary,,, emacs}.
200 @item diary-nongregorian-marking-hook
202 @inforef{Non-Gregorian Diary,, emacs-xtra}.
205 @xref{Non-Gregorian Diary,,, emacs}.
208 @item diary-print-entries-hook
210 @inforef{Diary Display,, emacs-xtra}.
213 @xref{Diary Display,,, emacs}.
216 @item disabled-command-function
217 @xref{Disabling Commands}.
219 @item echo-area-clear-hook
220 @xref{Echo Area Customization}.
222 @item emacs-startup-hook
226 @xref{Visiting Functions}.
228 @item find-file-not-found-functions
229 @xref{Visiting Functions}.
231 @item first-change-hook
234 @item font-lock-beginning-of-syntax-function
235 @xref{Syntactic Font Lock}.
237 @item font-lock-fontify-buffer-function
238 @xref{Other Font Lock Variables}.
240 @item font-lock-fontify-region-function
241 @xref{Other Font Lock Variables}.
243 @item font-lock-mark-block-function
244 @xref{Other Font Lock Variables}.
246 @item font-lock-syntactic-face-function
247 @xref{Syntactic Font Lock}.
249 @item font-lock-unfontify-buffer-function
250 @xref{Other Font Lock Variables}.
252 @item hack-local-variables-hook
253 @xref{File Local Variables}.
255 @item font-lock-unfontify-region-function
256 @xref{Other Font Lock Variables}.
258 @item kbd-macro-termination-hook
259 @xref{Keyboard Macros}.
261 @item kill-buffer-hook
262 @xref{Killing Buffers}.
264 @item kill-buffer-query-functions
265 @xref{Killing Buffers}.
267 @item kill-emacs-hook
268 @xref{Killing Emacs}.
270 @item kill-emacs-query-functions
271 @xref{Killing Emacs}.
273 @item lisp-indent-function
275 @item mail-setup-hook
276 @xref{Mail Mode Misc,, Mail Mode Miscellany, emacs, the GNU Emacs
279 @item menu-bar-update-hook
282 @item minibuffer-setup-hook
283 @xref{Minibuffer Misc}.
285 @item minibuffer-exit-hook
286 @xref{Minibuffer Misc}.
288 @item mouse-position-function
289 @xref{Mouse Position}.
293 @item post-command-hook
294 @xref{Command Overview}.
296 @item pre-command-hook
297 @xref{Command Overview}.
299 @item resume-tty-functions
300 @xref{Suspending Emacs}.
302 @item scheme-indent-function
305 @xref{Suspending Emacs}.
307 @item suspend-resume-hook
308 @xref{Suspending Emacs}.
310 @item suspend-tty-functions
311 @xref{Suspending Emacs}.
313 @item temp-buffer-setup-hook
314 @xref{Temporary Displays}.
316 @item temp-buffer-show-function
317 @xref{Temporary Displays}.
319 @item temp-buffer-show-hook
320 @xref{Temporary Displays}.
322 @item term-setup-hook
323 @xref{Terminal-Specific}.
325 @item window-configuration-change-hook
328 @item window-scroll-functions
331 @item window-setup-hook
332 @xref{Window Systems}.
334 @item window-size-change-functions
337 @item write-contents-functions
338 @xref{Saving Buffers}.
340 @item write-file-functions
341 @xref{Saving Buffers}.
343 @item write-region-annotate-functions
344 @xref{Format Conversion}.
348 arch-tag: 55fd0296-d906-4551-b300-979d3846aa88