(ad-compile-function): Suppress byte-compiler warnings, since it is annoying
[emacs.git] / doc / lispref / hooks.texi
blob4ef3f933770fed99060115b47dcaaa0d21de20bb
1 @c -*-texinfo-*-
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
9 @cindex 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
39 @c it here.
41 @table @code
42 @item abbrev-expand-functions
43 @xref{Abbrev Expansion}.
45 @item activate-mark-hook
46 @xref{The Mark}.
48 @item after-change-functions
49 @xref{Change Hooks}.
51 @item after-change-major-mode-hook
52 @xref{Mode Hooks}.
54 @item after-init-hook
55 @xref{Init File}.
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
64 @xref{Reverting}.
66 @item after-save-hook
67 @xref{Saving Buffers}.
69 @item auto-fill-function
70 @xref{Auto Filling}.
72 @item auto-save-hook
73 @xref{Auto-Saving}.
75 @item before-change-functions
76 @xref{Change Hooks}.
78 @item before-hack-local-variables-hook
79 @xref{File Local Variables}.
81 @item before-init-hook
82 @xref{Init File}.
84 @item before-make-frame-hook
85 @xref{Creating Frames}.
87 @item before-revert-hook
88 @xref{Reverting}.
90 @item before-save-hook
91 @xref{Saving Buffers}.
93 @item blink-paren-function
94 @xref{Blinking}.
96 @item buffer-access-fontify-functions
97 @xref{Lazy Properties}.
99 @item calendar-initial-window-hook
100 @iftex
101 @inforef{Calendar Customizing,, emacs-xtra}.
102 @end iftex
103 @ifnottex
104 @xref{Calendar Customizing,,, emacs}.
105 @end ifnottex
107 @item calendar-load-hook
108 @iftex
109 @inforef{Calendar Customizing,, emacs-xtra}.
110 @end iftex
111 @ifnottex
112 @xref{Calendar Customizing,,, emacs}.
113 @end ifnottex
115 @item calendar-today-invisible-hook
116 @iftex
117 @inforef{Calendar Customizing,, emacs-xtra}.
118 @end iftex
119 @ifnottex
120 @xref{Calendar Customizing,,, emacs}.
121 @end ifnottex
123 @item calendar-today-visible-hook
124 @iftex
125 @inforef{Calendar Customizing,, emacs-xtra}.
126 @end iftex
127 @ifnottex
128 @xref{Calendar Customizing,,, emacs}.
129 @end ifnottex
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
139 GNU Emacs Manual}.
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
148 @xref{The Mark}.
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
155 Terminals}.
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}.
172 @item diary-hook
173 List of functions called after the display of the diary.  Can be used
174 for appointment notification.
176 @item diary-list-entries-hook
177 @iftex
178 @inforef{Fancy Diary Display,, emacs-xtra}.
179 @end iftex
180 @ifnottex
181 @xref{Fancy Diary Display,,, emacs}.
182 @end ifnottex
184 @item diary-mark-entries-hook
185 @iftex
186 @inforef{Fancy Diary Display,, emacs-xtra}.
187 @end iftex
188 @ifnottex
189 @xref{Fancy Diary Display,,, emacs}.
190 @end ifnottex
192 @item diary-nongregorian-listing-hook
193 @iftex
194 @inforef{Non-Gregorian Diary,, emacs-xtra}.
195 @end iftex
196 @ifnottex
197 @xref{Non-Gregorian Diary,,, emacs}.
198 @end ifnottex
200 @item diary-nongregorian-marking-hook
201 @iftex
202 @inforef{Non-Gregorian Diary,, emacs-xtra}.
203 @end iftex
204 @ifnottex
205 @xref{Non-Gregorian Diary,,, emacs}.
206 @end ifnottex
208 @item diary-print-entries-hook
209 @iftex
210 @inforef{Diary Display,, emacs-xtra}.
211 @end iftex
212 @ifnottex
213 @xref{Diary Display,,, emacs}.
214 @end ifnottex
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
223 @xref{Init File}.
225 @item find-file-hook
226 @xref{Visiting Functions}.
228 @item find-file-not-found-functions
229 @xref{Visiting Functions}.
231 @item first-change-hook
232 @xref{Change Hooks}.
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
277 Manual}.
279 @item menu-bar-update-hook
280 @xref{Menu Bar}.
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}.
291 @item occur-hook
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
304 @item suspend-hook
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
326 @xref{Window Hooks}.
328 @item window-scroll-functions
329 @xref{Window Hooks}.
331 @item window-setup-hook
332 @xref{Window Systems}.
334 @item window-size-change-functions
335 @xref{Window Hooks}.
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}.
345 @end table
347 @ignore
348    arch-tag: 55fd0296-d906-4551-b300-979d3846aa88
349 @end ignore