Next: Index, Previous: Standard Keymaps, Up: Top
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 add-hook.
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.
activate-mark-hookdeactivate-mark-hookafter-change-functionsbefore-change-functionsfirst-change-hookafter-change-major-mode-hookchange-major-mode-after-body-hookafter-init-hookbefore-init-hookemacs-startup-hookwindow-setup-hookafter-insert-file-functionswrite-region-annotate-functionswrite-region-post-annotation-functionafter-make-frame-functionsbefore-make-frame-hookafter-save-hookbefore-save-hookwrite-contents-functionswrite-file-functionsafter-setting-font-hookauto-save-hookbefore-hack-local-variables-hookhack-local-variables-hookbuffer-access-fontify-functionsbuffer-list-update-hookbuffer-quit-functionchange-major-mode-hookcommand-line-functionsdelayed-warnings-hookpost-command-hook (q.v.).
focus-in-hookfocus-out-hookdelete-frame-functionsdelete-terminal-functionspop-up-frame-functionsplit-window-preferred-functionecho-area-clear-hookfind-file-hookfind-file-not-found-functionsfont-lock-extend-after-change-region-functionfont-lock-extend-region-functionsfont-lock-fontify-buffer-functionfont-lock-fontify-region-functionfont-lock-mark-block-functionfont-lock-unfontify-buffer-functionfont-lock-unfontify-region-functionfontification-functionsframe-auto-hide-functionkill-buffer-hookkill-buffer-query-functionskill-emacs-hookkill-emacs-query-functionsmenu-bar-update-hookminibuffer-setup-hookminibuffer-exit-hookmouse-leave-buffer-hookmouse-position-functionprefix-command-echo-keystrokes-functionsnil if there's no
prefix state. See Prefix Command Arguments.
prefix-command-preserve-state-hookpre-redisplay-functionspost-command-hookpre-command-hookpost-gc-hookpost-self-insert-hooksuspend-hooksuspend-resume-hooksuspend-tty-functionsresume-tty-functionssyntax-begin-functionsyntax-propertize-extend-region-functionssyntax-propertize-functionfont-lock-syntactic-face-functiontemp-buffer-setup-hooktemp-buffer-show-functiontemp-buffer-show-hooktty-setup-hookwindow-configuration-change-hookwindow-scroll-functionswindow-size-change-functions