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