The following is a list of some hook variables that let you provide functions to be called from within Emacs on suitable occasions.
Most of these variables have names ending with ‘-hook’. They are
normal hooks, run by means of
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
See Hooks, for more information about using hooks.
The variables whose names end in ‘-functions’ are usually abnormal hooks (some old code may also use the deprecated ‘-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 ‘-function’ have single functions as their values.
This is not an exhaustive list, it only covers the more general hooks.
For example, every major mode defines a hook named
‘modename-mode-hook’. The major mode command runs this
normal hook with
run-mode-hooks as the very last thing it does.
See Mode Hooks. Most minor modes have mode hooks too.
A special feature allows you to specify expressions to evaluate if and when a file is loaded (see Hooks for Loading). That feature is not exactly a hook, but does a similar job.
See The Mark.
See Change Hooks.
See Mode Hooks.
See Init File.
See Format Conversion.
See Creating Frames.
See Saving Buffers.
Hook run after a frame’s font changes.
See File Local Variables.
See Lazy Properties.
Hook run when the buffer list changes (see Buffer List).
Function to call to quit the current buffer.
See Creating Buffer-Local.
See Command-Line Arguments.
The command loop runs this soon after
See Input Focus.
See Deleting Frames.
See Multiple Terminals.
See Choosing Window Options.
See Echo Area Customization.
See Visiting Functions.
See Region to Refontify.
See Multiline Font Lock.
See Other Font Lock Variables.
See Automatic Face Assignment.
See Quitting Windows.
See Killing Buffers.
See Killing Emacs.
See Menu Bar.
See Minibuffer Misc.
Hook run when about to switch windows with a mouse command.
See Mouse Position.
An abnormal hook run by prefix commands (such as C-u) which
should return a string describing the current prefix state. For
example, C-u produces ‘C-u-’ and ‘C-u 1 2 3-’. Each
hook function is called with no arguments and should return a string
describing the current prefix state, or
nil if there’s no
prefix state. See Prefix Command Arguments.
Hook run when a prefix command needs to preserve the prefix by passing the current prefix command state to the next command. For example, C-u needs to pass the state to the next command when the user types C-u - or follows C-u with a digit.
Hook run in each window just before redisplaying it. See Forcing Redisplay.
See Command Overview.
See Garbage Collection.
See Keymaps and Minor Modes.
See Suspending Emacs.
See Syntactic Font Lock. See Syntax Properties.
See Temporary Displays.
See Window Hooks.
Functions to call in redisplay when text in the window might change.