2007-09-06 04:25:08 +00:00
|
|
|
@c -*-texinfo-*-
|
|
|
|
@c This is part of the GNU Emacs Lisp Reference Manual.
|
2014-01-01 07:43:34 +00:00
|
|
|
@c Copyright (C) 1990-1993, 1998, 2001-2014 Free Software Foundation,
|
2013-01-01 09:11:05 +00:00
|
|
|
@c Inc.
|
2007-09-06 04:25:08 +00:00
|
|
|
@c See the file elisp.texi for copying conditions.
|
2012-05-27 01:34:14 +00:00
|
|
|
@node Standard Hooks
|
2007-09-06 04:25:08 +00:00
|
|
|
@appendix Standard Hooks
|
|
|
|
@cindex standard hooks
|
|
|
|
@cindex hook variables, list of
|
|
|
|
|
2012-03-02 02:52:40 +00:00
|
|
|
The following is a list of some hook variables that let you provide
|
2007-09-06 04:25:08 +00:00
|
|
|
functions to be called from within Emacs on suitable occasions.
|
|
|
|
|
|
|
|
Most of these variables have names ending with @samp{-hook}. They are
|
|
|
|
@dfn{normal hooks}, run by means of @code{run-hooks}. The value of such
|
|
|
|
a hook is a list of functions; the functions are called with no
|
|
|
|
arguments and their values are completely ignored. The recommended way
|
|
|
|
to put a new function on such a hook is to call @code{add-hook}.
|
|
|
|
@xref{Hooks}, for more information about using hooks.
|
|
|
|
|
2012-10-23 15:06:07 +00:00
|
|
|
The variables whose names end in @samp{-functions} are usually @dfn{abnormal
|
|
|
|
hooks} (some old code may also use the deprecated @samp{-hooks} suffix); their
|
|
|
|
values are lists of functions, but these functions are called in a special way
|
|
|
|
(they are passed arguments, or their return values are used). The variables
|
|
|
|
whose names end in @samp{-function} have single functions as their values.
|
2007-09-06 04:25:08 +00:00
|
|
|
|
2012-03-02 02:52:40 +00:00
|
|
|
This is not an exhaustive list, it only covers the more general hooks.
|
|
|
|
For example, every major mode defines a hook named
|
|
|
|
@samp{@var{modename}-mode-hook}. The major mode command runs this
|
|
|
|
normal hook with @code{run-mode-hooks} as the very last thing it does.
|
|
|
|
@xref{Mode Hooks}. Most minor modes have mode hooks too.
|
|
|
|
|
2007-12-03 00:12:06 +00:00
|
|
|
A special feature allows you to specify expressions to evaluate if and
|
|
|
|
when a file is loaded (@pxref{Hooks for Loading}). That feature is
|
|
|
|
not exactly a hook, but does a similar job.
|
|
|
|
|
2012-03-02 02:52:40 +00:00
|
|
|
@c We need to xref to where each hook is documented or else document it here.
|
|
|
|
@c Add vindex for anything not indexed elsewhere.
|
|
|
|
@c This list is in alphabetical order, grouped by topic.
|
|
|
|
@c TODO It should probably be more thoroughly ordered by topic.
|
2007-09-06 04:25:08 +00:00
|
|
|
|
|
|
|
@table @code
|
|
|
|
@item activate-mark-hook
|
2012-03-02 02:52:40 +00:00
|
|
|
@itemx deactivate-mark-hook
|
2007-09-06 04:25:08 +00:00
|
|
|
@xref{The Mark}.
|
|
|
|
|
|
|
|
@item after-change-functions
|
2012-03-02 02:52:40 +00:00
|
|
|
@itemx before-change-functions
|
|
|
|
@itemx first-change-hook
|
2007-09-06 04:25:08 +00:00
|
|
|
@xref{Change Hooks}.
|
|
|
|
|
|
|
|
@item after-change-major-mode-hook
|
2012-03-02 02:52:40 +00:00
|
|
|
@itemx change-major-mode-after-body-hook
|
2007-09-06 04:25:08 +00:00
|
|
|
@xref{Mode Hooks}.
|
|
|
|
|
|
|
|
@item after-init-hook
|
2012-03-02 02:52:40 +00:00
|
|
|
@itemx before-init-hook
|
|
|
|
@itemx emacs-startup-hook
|
2007-09-06 04:25:08 +00:00
|
|
|
@xref{Init File}.
|
|
|
|
|
|
|
|
@item after-insert-file-functions
|
2012-03-02 02:52:40 +00:00
|
|
|
@itemx write-region-annotate-functions
|
|
|
|
@itemx write-region-post-annotation-function
|
2007-09-06 04:25:08 +00:00
|
|
|
@xref{Format Conversion}.
|
|
|
|
|
|
|
|
@item after-make-frame-functions
|
2012-03-02 02:52:40 +00:00
|
|
|
@itemx before-make-frame-hook
|
2007-09-06 04:25:08 +00:00
|
|
|
@xref{Creating Frames}.
|
|
|
|
|
2012-03-02 02:52:40 +00:00
|
|
|
@c Not general enough?
|
|
|
|
@ignore
|
2007-09-06 04:25:08 +00:00
|
|
|
@item after-revert-hook
|
2012-03-02 02:52:40 +00:00
|
|
|
@itemx before-revert-hook
|
|
|
|
@itemx buffer-stale-function
|
|
|
|
@itemx revert-buffer-function
|
|
|
|
@itemx revert-buffer-insert-file-contents-function
|
2007-09-06 04:25:08 +00:00
|
|
|
@xref{Reverting}.
|
2012-03-02 02:52:40 +00:00
|
|
|
@end ignore
|
2007-09-06 04:25:08 +00:00
|
|
|
|
|
|
|
@item after-save-hook
|
2012-03-02 02:52:40 +00:00
|
|
|
@itemx before-save-hook
|
|
|
|
@itemx write-contents-functions
|
|
|
|
@itemx write-file-functions
|
2007-09-06 04:25:08 +00:00
|
|
|
@xref{Saving Buffers}.
|
|
|
|
|
2012-03-02 02:52:40 +00:00
|
|
|
@item after-setting-font-hook
|
|
|
|
@vindex after-setting-font-hook
|
|
|
|
Hook run after a frame's font changes.
|
2007-09-06 04:25:08 +00:00
|
|
|
|
|
|
|
@item auto-save-hook
|
|
|
|
@xref{Auto-Saving}.
|
|
|
|
|
2008-10-19 13:00:20 +00:00
|
|
|
@item before-hack-local-variables-hook
|
2012-03-02 02:52:40 +00:00
|
|
|
@itemx hack-local-variables-hook
|
2008-10-19 13:00:20 +00:00
|
|
|
@xref{File Local Variables}.
|
|
|
|
|
2007-09-06 04:25:08 +00:00
|
|
|
@item buffer-access-fontify-functions
|
|
|
|
@xref{Lazy Properties}.
|
|
|
|
|
2012-03-02 02:52:40 +00:00
|
|
|
@item buffer-list-update-hook
|
|
|
|
@vindex buffer-list-update-hook
|
|
|
|
Hook run when the buffer list changes.
|
|
|
|
|
|
|
|
@item buffer-quit-function
|
|
|
|
@vindex buffer-quit-function
|
|
|
|
Function to call to ``quit'' the current buffer.
|
2012-02-02 02:57:26 +00:00
|
|
|
|
2007-09-06 04:25:08 +00:00
|
|
|
@item change-major-mode-hook
|
|
|
|
@xref{Creating Buffer-Local}.
|
|
|
|
|
|
|
|
@item command-line-functions
|
|
|
|
@xref{Command-Line Arguments}.
|
|
|
|
|
2012-03-02 02:52:40 +00:00
|
|
|
@item delayed-warnings-hook
|
|
|
|
@vindex delayed-warnings-hook
|
|
|
|
The command loop runs this soon after @code{post-command-hook} (q.v.).
|
2007-09-06 04:25:08 +00:00
|
|
|
|
2013-11-23 19:07:34 +00:00
|
|
|
@item focus-in-hook
|
|
|
|
@vindex focus-in-hook
|
|
|
|
@itemx focus-out-hook
|
|
|
|
@vindex focus-out-hook
|
|
|
|
@xref{Input Focus}.
|
|
|
|
|
2009-01-17 16:32:09 +00:00
|
|
|
@item delete-frame-functions
|
2012-03-02 02:52:40 +00:00
|
|
|
@xref{Deleting Frames}.
|
2009-01-17 16:32:09 +00:00
|
|
|
|
|
|
|
@item delete-terminal-functions
|
2012-03-02 02:52:40 +00:00
|
|
|
@xref{Multiple Terminals}.
|
2009-12-05 03:25:57 +00:00
|
|
|
|
2013-01-05 08:37:05 +00:00
|
|
|
@item pop-up-frame-function
|
2012-03-02 02:52:40 +00:00
|
|
|
@itemx split-window-preferred-function
|
|
|
|
@xref{Choosing Window Options}.
|
2007-09-06 04:25:08 +00:00
|
|
|
|
|
|
|
@item echo-area-clear-hook
|
|
|
|
@xref{Echo Area Customization}.
|
|
|
|
|
|
|
|
@item find-file-hook
|
2012-03-02 02:52:40 +00:00
|
|
|
@itemx find-file-not-found-functions
|
2007-09-06 04:25:08 +00:00
|
|
|
@xref{Visiting Functions}.
|
|
|
|
|
2012-03-02 02:52:40 +00:00
|
|
|
@item font-lock-extend-after-change-region-function
|
|
|
|
@xref{Region to Refontify}.
|
2007-09-06 04:25:08 +00:00
|
|
|
|
2012-03-02 02:52:40 +00:00
|
|
|
@item font-lock-extend-region-functions
|
|
|
|
@xref{Multiline Font Lock}.
|
2007-09-06 04:25:08 +00:00
|
|
|
|
|
|
|
@item font-lock-fontify-buffer-function
|
2012-03-02 02:52:40 +00:00
|
|
|
@itemx font-lock-fontify-region-function
|
|
|
|
@itemx font-lock-mark-block-function
|
|
|
|
@itemx font-lock-unfontify-buffer-function
|
|
|
|
@itemx font-lock-unfontify-region-function
|
2007-09-06 04:25:08 +00:00
|
|
|
@xref{Other Font Lock Variables}.
|
|
|
|
|
2012-03-02 02:52:40 +00:00
|
|
|
@item fontification-functions
|
|
|
|
@xref{Auto Faces,, Automatic Face Assignment}.
|
2007-09-06 04:25:08 +00:00
|
|
|
|
2012-03-02 02:52:40 +00:00
|
|
|
@item frame-auto-hide-function
|
|
|
|
@xref{Quitting Windows}.
|
2007-09-06 04:25:08 +00:00
|
|
|
|
|
|
|
@item kill-buffer-hook
|
2012-03-02 02:52:40 +00:00
|
|
|
@itemx kill-buffer-query-functions
|
2007-09-06 04:25:08 +00:00
|
|
|
@xref{Killing Buffers}.
|
|
|
|
|
|
|
|
@item kill-emacs-hook
|
2012-03-02 02:52:40 +00:00
|
|
|
@itemx kill-emacs-query-functions
|
2007-09-06 04:25:08 +00:00
|
|
|
@xref{Killing Emacs}.
|
|
|
|
|
|
|
|
@item menu-bar-update-hook
|
|
|
|
@xref{Menu Bar}.
|
|
|
|
|
|
|
|
@item minibuffer-setup-hook
|
2012-03-02 02:52:40 +00:00
|
|
|
@itemx minibuffer-exit-hook
|
2007-09-06 04:25:08 +00:00
|
|
|
@xref{Minibuffer Misc}.
|
|
|
|
|
2012-03-02 02:52:40 +00:00
|
|
|
@item mouse-leave-buffer-hook
|
|
|
|
@vindex mouse-leave-buffer-hook
|
|
|
|
Hook run when about to switch windows with a mouse command.
|
2007-09-06 04:25:08 +00:00
|
|
|
|
|
|
|
@item mouse-position-function
|
|
|
|
@xref{Mouse Position}.
|
|
|
|
|
|
|
|
@item post-command-hook
|
2012-03-02 02:52:40 +00:00
|
|
|
@itemx pre-command-hook
|
2007-09-06 04:25:08 +00:00
|
|
|
@xref{Command Overview}.
|
|
|
|
|
2012-03-02 02:52:40 +00:00
|
|
|
@item post-gc-hook
|
|
|
|
@xref{Garbage Collection}.
|
|
|
|
|
2012-02-02 04:37:05 +00:00
|
|
|
@item post-self-insert-hook
|
|
|
|
@xref{Keymaps and Minor Modes}.
|
|
|
|
|
2012-03-02 02:52:40 +00:00
|
|
|
@ignore
|
2012-02-02 04:28:15 +00:00
|
|
|
@item prog-mode-hook
|
2012-03-02 02:52:40 +00:00
|
|
|
@itemx special-mode-hook
|
|
|
|
@vindex special-mode-hook
|
2012-02-02 04:28:15 +00:00
|
|
|
@xref{Basic Major Modes}.
|
2012-03-02 02:52:40 +00:00
|
|
|
@end ignore
|
2009-01-17 18:47:53 +00:00
|
|
|
|
2007-09-06 04:25:08 +00:00
|
|
|
@item suspend-hook
|
2012-03-02 02:52:40 +00:00
|
|
|
@itemx suspend-resume-hook
|
|
|
|
@itemx suspend-tty-functions
|
|
|
|
@itemx resume-tty-functions
|
2007-09-06 04:25:08 +00:00
|
|
|
@xref{Suspending Emacs}.
|
|
|
|
|
2012-03-02 02:52:40 +00:00
|
|
|
@item syntax-begin-function
|
|
|
|
@itemx syntax-propertize-extend-region-functions
|
|
|
|
@itemx syntax-propertize-function
|
|
|
|
@itemx font-lock-syntactic-face-function
|
|
|
|
@xref{Syntactic Font Lock}. @xref{Syntax Properties}.
|
2007-09-06 04:25:08 +00:00
|
|
|
|
|
|
|
@item temp-buffer-setup-hook
|
2012-03-02 02:52:40 +00:00
|
|
|
@itemx temp-buffer-show-function
|
|
|
|
@itemx temp-buffer-show-hook
|
2007-09-06 04:25:08 +00:00
|
|
|
@xref{Temporary Displays}.
|
|
|
|
|
|
|
|
@item term-setup-hook
|
|
|
|
@xref{Terminal-Specific}.
|
|
|
|
|
|
|
|
@item window-configuration-change-hook
|
2012-03-02 02:52:40 +00:00
|
|
|
@itemx window-scroll-functions
|
|
|
|
@itemx window-size-change-functions
|
2007-09-06 04:25:08 +00:00
|
|
|
@xref{Window Hooks}.
|
|
|
|
|
|
|
|
@item window-setup-hook
|
|
|
|
@xref{Window Systems}.
|
|
|
|
|
2012-03-02 02:52:40 +00:00
|
|
|
@item window-text-change-functions
|
|
|
|
@vindex window-text-change-functions
|
|
|
|
Functions to call in redisplay when text in the window might change.
|
2007-09-06 04:25:08 +00:00
|
|
|
|
|
|
|
@end table
|
2012-03-02 02:52:40 +00:00
|
|
|
|
|
|
|
@ignore
|
|
|
|
Some -hook, -function, -functions from preloaded Lisp or C files that
|
|
|
|
I thought did not need to be mentioned here:
|
|
|
|
|
|
|
|
Lisp:
|
|
|
|
after-load-functions
|
|
|
|
auto-coding-functions
|
|
|
|
choose-completion-string-functions
|
|
|
|
completing-read-function
|
|
|
|
completion-annotate-function
|
|
|
|
completion-at-point-functions
|
|
|
|
completion-in-region-functions
|
|
|
|
completion-list-insert-choice-function
|
2012-07-29 07:16:45 +00:00
|
|
|
deactivate-current-input-method-function
|
2012-03-02 02:52:40 +00:00
|
|
|
describe-current-input-method-function
|
|
|
|
filter-buffer-substring-functions
|
|
|
|
font-lock-function
|
|
|
|
menu-bar-select-buffer-function
|
|
|
|
read-file-name-function
|
|
|
|
replace-re-search-function
|
|
|
|
replace-search-function
|
|
|
|
yank-undo-function
|
|
|
|
|
|
|
|
C hooks:
|
|
|
|
kbd-macro-termination-hook
|
|
|
|
signal-hook-function
|
|
|
|
|
|
|
|
C functions:
|
|
|
|
redisplay-end-trigger-functions
|
|
|
|
x-lost-selection-functions
|
|
|
|
x-sent-selection-functions
|
|
|
|
|
|
|
|
C function:
|
|
|
|
auto-composition-function
|
|
|
|
auto-fill-function
|
|
|
|
command-error-function
|
|
|
|
compose-chars-after-function
|
|
|
|
composition-function-table
|
|
|
|
deferred-action-function
|
|
|
|
input-method-function
|
|
|
|
load-read-function
|
|
|
|
load-source-file-function
|
|
|
|
read-buffer-function
|
|
|
|
ring-bell-function
|
|
|
|
select-safe-coding-system-function
|
|
|
|
set-auto-coding-function
|
|
|
|
show-help-function
|
|
|
|
signal-hook-function
|
|
|
|
undo-outer-limit-function
|
|
|
|
|
|
|
|
@end ignore
|