More Emacs 24.3 documentation updates.
[bpt/emacs.git] / doc / lispref / hooks.texi
CommitLineData
b8d4c8d0
GM
1@c -*-texinfo-*-
2@c This is part of the GNU Emacs Lisp Reference Manual.
90db9af9 3@c Copyright (C) 1990-1993, 1998, 2001-2012 Free Software Foundation, Inc.
b8d4c8d0 4@c See the file elisp.texi for copying conditions.
ecc6530d 5@node Standard Hooks
b8d4c8d0
GM
6@appendix Standard Hooks
7@cindex standard hooks
8@cindex hook variables, list of
9
2064cc6a 10The following is a list of some hook variables that let you provide
b8d4c8d0
GM
11functions to be called from within Emacs on suitable occasions.
12
13Most of these variables have names ending with @samp{-hook}. They are
14@dfn{normal hooks}, run by means of @code{run-hooks}. The value of such
15a hook is a list of functions; the functions are called with no
16arguments and their values are completely ignored. The recommended way
17to put a new function on such a hook is to call @code{add-hook}.
18@xref{Hooks}, for more information about using hooks.
19
d1069532
SM
20The variables whose names end in @samp{-functions} are usually @dfn{abnormal
21hooks} (some old code may also use the deprecated @samp{-hooks} suffix); their
22values are lists of functions, but these functions are called in a special way
23(they are passed arguments, or their return values are used). The variables
24whose names end in @samp{-function} have single functions as their values.
b8d4c8d0 25
2064cc6a
GM
26This is not an exhaustive list, it only covers the more general hooks.
27For example, every major mode defines a hook named
28@samp{@var{modename}-mode-hook}. The major mode command runs this
29normal hook with @code{run-mode-hooks} as the very last thing it does.
30@xref{Mode Hooks}. Most minor modes have mode hooks too.
31
b694135c
RS
32A special feature allows you to specify expressions to evaluate if and
33when a file is loaded (@pxref{Hooks for Loading}). That feature is
34not exactly a hook, but does a similar job.
35
2064cc6a
GM
36@c We need to xref to where each hook is documented or else document it here.
37@c Add vindex for anything not indexed elsewhere.
38@c This list is in alphabetical order, grouped by topic.
39@c TODO It should probably be more thoroughly ordered by topic.
b8d4c8d0
GM
40
41@table @code
42@item activate-mark-hook
2064cc6a 43@itemx deactivate-mark-hook
b8d4c8d0
GM
44@xref{The Mark}.
45
46@item after-change-functions
2064cc6a
GM
47@itemx before-change-functions
48@itemx first-change-hook
b8d4c8d0
GM
49@xref{Change Hooks}.
50
51@item after-change-major-mode-hook
2064cc6a 52@itemx change-major-mode-after-body-hook
b8d4c8d0
GM
53@xref{Mode Hooks}.
54
55@item after-init-hook
2064cc6a
GM
56@itemx before-init-hook
57@itemx emacs-startup-hook
b8d4c8d0
GM
58@xref{Init File}.
59
60@item after-insert-file-functions
2064cc6a
GM
61@itemx write-region-annotate-functions
62@itemx write-region-post-annotation-function
b8d4c8d0
GM
63@xref{Format Conversion}.
64
65@item after-make-frame-functions
2064cc6a 66@itemx before-make-frame-hook
b8d4c8d0
GM
67@xref{Creating Frames}.
68
2064cc6a
GM
69@c Not general enough?
70@ignore
b8d4c8d0 71@item after-revert-hook
2064cc6a
GM
72@itemx before-revert-hook
73@itemx buffer-stale-function
74@itemx revert-buffer-function
75@itemx revert-buffer-insert-file-contents-function
b8d4c8d0 76@xref{Reverting}.
2064cc6a 77@end ignore
b8d4c8d0
GM
78
79@item after-save-hook
2064cc6a
GM
80@itemx before-save-hook
81@itemx write-contents-functions
82@itemx write-file-functions
b8d4c8d0
GM
83@xref{Saving Buffers}.
84
2064cc6a
GM
85@item after-setting-font-hook
86@vindex after-setting-font-hook
87Hook run after a frame's font changes.
b8d4c8d0
GM
88
89@item auto-save-hook
90@xref{Auto-Saving}.
91
66af33fc 92@item before-hack-local-variables-hook
2064cc6a 93@itemx hack-local-variables-hook
66af33fc
EZ
94@xref{File Local Variables}.
95
b8d4c8d0
GM
96@item buffer-access-fontify-functions
97@xref{Lazy Properties}.
98
2064cc6a
GM
99@item buffer-list-update-hook
100@vindex buffer-list-update-hook
101Hook run when the buffer list changes.
102
103@item buffer-quit-function
104@vindex buffer-quit-function
105Function to call to ``quit'' the current buffer.
12f381b7 106
b8d4c8d0
GM
107@item change-major-mode-hook
108@xref{Creating Buffer-Local}.
109
110@item command-line-functions
111@xref{Command-Line Arguments}.
112
2064cc6a
GM
113@item delayed-warnings-hook
114@vindex delayed-warnings-hook
115The command loop runs this soon after @code{post-command-hook} (q.v.).
b8d4c8d0 116
0ed8034e 117@item delete-frame-functions
2064cc6a 118@xref{Deleting Frames}.
0ed8034e
EZ
119
120@item delete-terminal-functions
2064cc6a 121@xref{Multiple Terminals}.
e799b4f9 122
2064cc6a 123@itemx pop-up-frame-function
2064cc6a
GM
124@itemx split-window-preferred-function
125@xref{Choosing Window Options}.
b8d4c8d0
GM
126
127@item echo-area-clear-hook
128@xref{Echo Area Customization}.
129
b8d4c8d0 130@item find-file-hook
2064cc6a 131@itemx find-file-not-found-functions
b8d4c8d0
GM
132@xref{Visiting Functions}.
133
2064cc6a
GM
134@item font-lock-extend-after-change-region-function
135@xref{Region to Refontify}.
b8d4c8d0 136
2064cc6a
GM
137@item font-lock-extend-region-functions
138@xref{Multiline Font Lock}.
b8d4c8d0
GM
139
140@item font-lock-fontify-buffer-function
2064cc6a
GM
141@itemx font-lock-fontify-region-function
142@itemx font-lock-mark-block-function
143@itemx font-lock-unfontify-buffer-function
144@itemx font-lock-unfontify-region-function
b8d4c8d0
GM
145@xref{Other Font Lock Variables}.
146
2064cc6a
GM
147@item fontification-functions
148@xref{Auto Faces,, Automatic Face Assignment}.
b8d4c8d0 149
2064cc6a
GM
150@item frame-auto-hide-function
151@xref{Quitting Windows}.
b8d4c8d0
GM
152
153@item kill-buffer-hook
2064cc6a 154@itemx kill-buffer-query-functions
b8d4c8d0
GM
155@xref{Killing Buffers}.
156
157@item kill-emacs-hook
2064cc6a 158@itemx kill-emacs-query-functions
b8d4c8d0
GM
159@xref{Killing Emacs}.
160
b8d4c8d0
GM
161@item menu-bar-update-hook
162@xref{Menu Bar}.
163
164@item minibuffer-setup-hook
2064cc6a 165@itemx minibuffer-exit-hook
b8d4c8d0
GM
166@xref{Minibuffer Misc}.
167
2064cc6a
GM
168@item mouse-leave-buffer-hook
169@vindex mouse-leave-buffer-hook
170Hook run when about to switch windows with a mouse command.
b8d4c8d0
GM
171
172@item mouse-position-function
173@xref{Mouse Position}.
174
b8d4c8d0 175@item post-command-hook
2064cc6a 176@itemx pre-command-hook
b8d4c8d0
GM
177@xref{Command Overview}.
178
2064cc6a
GM
179@item post-gc-hook
180@xref{Garbage Collection}.
181
f58b9822
GM
182@item post-self-insert-hook
183@xref{Keymaps and Minor Modes}.
184
2064cc6a 185@ignore
b030b3df 186@item prog-mode-hook
2064cc6a
GM
187@itemx special-mode-hook
188@vindex special-mode-hook
b030b3df 189@xref{Basic Major Modes}.
2064cc6a 190@end ignore
490f1197 191
b8d4c8d0 192@item suspend-hook
2064cc6a
GM
193@itemx suspend-resume-hook
194@itemx suspend-tty-functions
195@itemx resume-tty-functions
b8d4c8d0
GM
196@xref{Suspending Emacs}.
197
2064cc6a
GM
198@item syntax-begin-function
199@itemx syntax-propertize-extend-region-functions
200@itemx syntax-propertize-function
201@itemx font-lock-syntactic-face-function
202@xref{Syntactic Font Lock}. @xref{Syntax Properties}.
b8d4c8d0
GM
203
204@item temp-buffer-setup-hook
2064cc6a
GM
205@itemx temp-buffer-show-function
206@itemx temp-buffer-show-hook
b8d4c8d0
GM
207@xref{Temporary Displays}.
208
209@item term-setup-hook
210@xref{Terminal-Specific}.
211
b8d4c8d0 212@item window-configuration-change-hook
2064cc6a
GM
213@itemx window-scroll-functions
214@itemx window-size-change-functions
b8d4c8d0
GM
215@xref{Window Hooks}.
216
217@item window-setup-hook
218@xref{Window Systems}.
219
2064cc6a
GM
220@item window-text-change-functions
221@vindex window-text-change-functions
222Functions to call in redisplay when text in the window might change.
b8d4c8d0 223
b8d4c8d0 224@end table
2064cc6a
GM
225
226@ignore
227Some -hook, -function, -functions from preloaded Lisp or C files that
228I thought did not need to be mentioned here:
229
230Lisp:
231after-load-functions
232auto-coding-functions
233choose-completion-string-functions
234completing-read-function
235completion-annotate-function
236completion-at-point-functions
237completion-in-region-functions
238completion-list-insert-choice-function
72b255c7 239deactivate-current-input-method-function
2064cc6a
GM
240describe-current-input-method-function
241filter-buffer-substring-functions
242font-lock-function
2064cc6a
GM
243menu-bar-select-buffer-function
244read-file-name-function
245replace-re-search-function
246replace-search-function
247yank-undo-function
248
249C hooks:
250kbd-macro-termination-hook
251signal-hook-function
252
253C functions:
254redisplay-end-trigger-functions
255x-lost-selection-functions
256x-sent-selection-functions
257
258C function:
259auto-composition-function
260auto-fill-function
261command-error-function
262compose-chars-after-function
263composition-function-table
264deferred-action-function
265input-method-function
266load-read-function
267load-source-file-function
2064cc6a
GM
268read-buffer-function
269ring-bell-function
270select-safe-coding-system-function
271set-auto-coding-function
272show-help-function
273signal-hook-function
274undo-outer-limit-function
275
276@end ignore