Merge from trunk
[emacs.git] / doc / lispref / hooks.texi
blob6e2cac9c06571d9ad2dba6e9b659b95364b95698
1 @c -*-texinfo-*-
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
8 @cindex 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
38 @c it here.
40 @table @code
41 @item abbrev-expand-functions
42 @xref{Abbrev Expansion}.
44 @item activate-mark-hook
45 @xref{The Mark}.
47 @item after-change-functions
48 @xref{Change Hooks}.
50 @item after-change-major-mode-hook
51 @xref{Mode Hooks}.
53 @item after-init-hook
54 @xref{Init File}.
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
63 @xref{Reverting}.
65 @item after-save-hook
66 @xref{Saving Buffers}.
68 @item auto-fill-function
69 @xref{Auto Filling}.
71 @item auto-save-hook
72 @xref{Auto-Saving}.
74 @item before-change-functions
75 @xref{Change Hooks}.
77 @item before-hack-local-variables-hook
78 @xref{File Local Variables}.
80 @item before-init-hook
81 @xref{Init File}.
83 @item before-make-frame-hook
84 @xref{Creating Frames}.
86 @item before-revert-hook
87 @xref{Reverting}.
89 @item before-save-hook
90 @xref{Saving Buffers}.
92 @item blink-paren-function
93 @xref{Blinking}.
95 @item buffer-access-fontify-functions
96 @xref{Lazy Properties}.
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
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
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
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
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
138 GNU Emacs Manual}.
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
147 @xref{The Mark}.
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
154 Terminals}.
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}.
171 @item diary-hook
172 List of functions called after the display of the diary.  Can be used
173 for appointment notification.
175 @item diary-list-entries-hook
176 @iftex
177 @inforef{Fancy Diary Display,, emacs-xtra}.
178 @end iftex
179 @ifnottex
180 @xref{Fancy Diary Display,,, emacs}.
181 @end ifnottex
183 @item diary-mark-entries-hook
184 @iftex
185 @inforef{Fancy Diary Display,, emacs-xtra}.
186 @end iftex
187 @ifnottex
188 @xref{Fancy Diary Display,,, emacs}.
189 @end ifnottex
191 @item diary-nongregorian-listing-hook
192 @iftex
193 @inforef{Non-Gregorian Diary,, emacs-xtra}.
194 @end iftex
195 @ifnottex
196 @xref{Non-Gregorian Diary,,, emacs}.
197 @end ifnottex
199 @item diary-nongregorian-marking-hook
200 @iftex
201 @inforef{Non-Gregorian Diary,, emacs-xtra}.
202 @end iftex
203 @ifnottex
204 @xref{Non-Gregorian Diary,,, emacs}.
205 @end ifnottex
207 @item diary-print-entries-hook
208 @iftex
209 @inforef{Diary Display,, emacs-xtra}.
210 @end iftex
211 @ifnottex
212 @xref{Diary Display,,, emacs}.
213 @end ifnottex
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
222 @xref{Init File}.
224 @item find-file-hook
225 @xref{Visiting Functions}.
227 @item find-file-not-found-functions
228 @xref{Visiting Functions}.
230 @item first-change-hook
231 @xref{Change Hooks}.
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
276 Manual}.
278 @item menu-bar-update-hook
279 @xref{Menu Bar}.
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}.
290 @item occur-hook
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
303 @item suspend-hook
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
325 @xref{Window Hooks}.
327 @item window-scroll-functions
328 @xref{Window Hooks}.
330 @item window-setup-hook
331 @xref{Window Systems}.
333 @item window-size-change-functions
334 @xref{Window Hooks}.
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}.
344 @end table