commands.texi small fix for bug#13393
[emacs.git] / doc / lispref / hooks.texi
blob745393f8166343348ed017199db8100303c108dc
1 @c -*-texinfo-*-
2 @c This is part of the GNU Emacs Lisp Reference Manual.
3 @c Copyright (C) 1990-1993, 1998, 2001-2013 Free Software Foundation,
4 @c Inc.
5 @c See the file elisp.texi for copying conditions.
6 @node Standard Hooks
7 @appendix Standard Hooks
8 @cindex standard hooks
9 @cindex hook variables, list of
11 The following is a list of some 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 The variables whose names end in @samp{-functions} are usually @dfn{abnormal
22 hooks} (some old code may also use the deprecated @samp{-hooks} suffix); their
23 values 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
25 whose names end in @samp{-function} have single functions as their values.
27 This is not an exhaustive list, it only covers the more general hooks.
28 For example, every major mode defines a hook named
29 @samp{@var{modename}-mode-hook}.  The major mode command runs this
30 normal hook with @code{run-mode-hooks} as the very last thing it does.
31 @xref{Mode Hooks}.  Most minor modes have mode hooks too.
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 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.
42 @table @code
43 @item activate-mark-hook
44 @itemx deactivate-mark-hook
45 @xref{The Mark}.
47 @item after-change-functions
48 @itemx before-change-functions
49 @itemx first-change-hook
50 @xref{Change Hooks}.
52 @item after-change-major-mode-hook
53 @itemx change-major-mode-after-body-hook
54 @xref{Mode Hooks}.
56 @item after-init-hook
57 @itemx before-init-hook
58 @itemx emacs-startup-hook
59 @xref{Init File}.
61 @item after-insert-file-functions
62 @itemx write-region-annotate-functions
63 @itemx write-region-post-annotation-function
64 @xref{Format Conversion}.
66 @item after-make-frame-functions
67 @itemx before-make-frame-hook
68 @xref{Creating Frames}.
70 @c Not general enough?
71 @ignore
72 @item after-revert-hook
73 @itemx before-revert-hook
74 @itemx buffer-stale-function
75 @itemx revert-buffer-function
76 @itemx revert-buffer-insert-file-contents-function
77 @xref{Reverting}.
78 @end ignore
80 @item after-save-hook
81 @itemx before-save-hook
82 @itemx write-contents-functions
83 @itemx write-file-functions
84 @xref{Saving Buffers}.
86 @item after-setting-font-hook
87 @vindex after-setting-font-hook
88 Hook run after a frame's font changes.
90 @item auto-save-hook
91 @xref{Auto-Saving}.
93 @item before-hack-local-variables-hook
94 @itemx hack-local-variables-hook
95 @xref{File Local Variables}.
97 @item buffer-access-fontify-functions
98 @xref{Lazy Properties}.
100 @item buffer-list-update-hook
101 @vindex buffer-list-update-hook
102 Hook run when the buffer list changes.
104 @item buffer-quit-function
105 @vindex buffer-quit-function
106 Function to call to ``quit'' the current buffer.
108 @item change-major-mode-hook
109 @xref{Creating Buffer-Local}.
111 @item command-line-functions
112 @xref{Command-Line Arguments}.
114 @item delayed-warnings-hook
115 @vindex delayed-warnings-hook
116 The command loop runs this soon after @code{post-command-hook} (q.v.).
118 @item delete-frame-functions
119 @xref{Deleting Frames}.
121 @item delete-terminal-functions
122 @xref{Multiple Terminals}.
124 @item pop-up-frame-function
125 @itemx split-window-preferred-function
126 @xref{Choosing Window Options}.
128 @item echo-area-clear-hook
129 @xref{Echo Area Customization}.
131 @item find-file-hook
132 @itemx find-file-not-found-functions
133 @xref{Visiting Functions}.
135 @item font-lock-extend-after-change-region-function
136 @xref{Region to Refontify}.
138 @item font-lock-extend-region-functions
139 @xref{Multiline Font Lock}.
141 @item font-lock-fontify-buffer-function
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
146 @xref{Other Font Lock Variables}.
148 @item fontification-functions
149 @xref{Auto Faces,, Automatic Face Assignment}.
151 @item frame-auto-hide-function
152 @xref{Quitting Windows}.
154 @item kill-buffer-hook
155 @itemx kill-buffer-query-functions
156 @xref{Killing Buffers}.
158 @item kill-emacs-hook
159 @itemx kill-emacs-query-functions
160 @xref{Killing Emacs}.
162 @item menu-bar-update-hook
163 @xref{Menu Bar}.
165 @item minibuffer-setup-hook
166 @itemx minibuffer-exit-hook
167 @xref{Minibuffer Misc}.
169 @item mouse-leave-buffer-hook
170 @vindex mouse-leave-buffer-hook
171 Hook run when about to switch windows with a mouse command.
173 @item mouse-position-function
174 @xref{Mouse Position}.
176 @item post-command-hook
177 @itemx pre-command-hook
178 @xref{Command Overview}.
180 @item post-gc-hook
181 @xref{Garbage Collection}.
183 @item post-self-insert-hook
184 @xref{Keymaps and Minor Modes}.
186 @ignore
187 @item prog-mode-hook
188 @itemx special-mode-hook
189 @vindex special-mode-hook
190 @xref{Basic Major Modes}.
191 @end ignore
193 @item suspend-hook
194 @itemx suspend-resume-hook
195 @itemx suspend-tty-functions
196 @itemx resume-tty-functions
197 @xref{Suspending Emacs}.
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}.
205 @item temp-buffer-setup-hook
206 @itemx temp-buffer-show-function
207 @itemx temp-buffer-show-hook
208 @xref{Temporary Displays}.
210 @item term-setup-hook
211 @xref{Terminal-Specific}.
213 @item window-configuration-change-hook
214 @itemx window-scroll-functions
215 @itemx window-size-change-functions
216 @xref{Window Hooks}.
218 @item window-setup-hook
219 @xref{Window Systems}.
221 @item window-text-change-functions
222 @vindex window-text-change-functions
223 Functions to call in redisplay when text in the window might change.
225 @end table
227 @ignore
228 Some -hook, -function, -functions from preloaded Lisp or C files that
229 I thought did not need to be mentioned here:
231 Lisp:
232 after-load-functions
233 auto-coding-functions
234 choose-completion-string-functions
235 completing-read-function
236 completion-annotate-function
237 completion-at-point-functions
238 completion-in-region-functions
239 completion-list-insert-choice-function
240 deactivate-current-input-method-function
241 describe-current-input-method-function
242 filter-buffer-substring-functions
243 font-lock-function
244 menu-bar-select-buffer-function
245 read-file-name-function
246 replace-re-search-function
247 replace-search-function
248 yank-undo-function
250 C hooks:
251 kbd-macro-termination-hook
252 signal-hook-function
254 C functions:
255 redisplay-end-trigger-functions
256 x-lost-selection-functions
257 x-sent-selection-functions
259 C function:
260 auto-composition-function
261 auto-fill-function
262 command-error-function
263 compose-chars-after-function
264 composition-function-table
265 deferred-action-function
266 input-method-function
267 load-read-function
268 load-source-file-function
269 read-buffer-function
270 ring-bell-function
271 select-safe-coding-system-function
272 set-auto-coding-function
273 show-help-function
274 signal-hook-function
275 undo-outer-limit-function
277 @end ignore