elisp: Standard Hooks

 
 Appendix H Standard Hooks
 *************************
 
 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’.  SeeHooks, 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.  SeeMode 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 (SeeHooks for Loading).  That feature is
 not exactly a hook, but does a similar job.
 
 ‘activate-mark-hook’
 ‘deactivate-mark-hook’
      SeeThe Mark.
 
 ‘after-change-functions’
 ‘before-change-functions’
 ‘first-change-hook’
      SeeChange Hooks.
 
 ‘after-change-major-mode-hook’
 ‘change-major-mode-after-body-hook’
      SeeMode Hooks.
 
 ‘after-init-hook’
 ‘before-init-hook’
 ‘emacs-startup-hook’
 ‘window-setup-hook’
      SeeInit File.
 
 ‘after-insert-file-functions’
 ‘write-region-annotate-functions’
 ‘write-region-post-annotation-function’
      SeeFormat Conversion.
 
 ‘after-make-frame-functions’
 ‘before-make-frame-hook’
      SeeCreating Frames.
 
 ‘after-save-hook’
 ‘before-save-hook’
 ‘write-contents-functions’
 ‘write-file-functions’
      SeeSaving Buffers.
 
 ‘after-setting-font-hook’
      Hook run after a frame’s font changes.
 
 ‘auto-save-hook’
      SeeAuto-Saving.
 
 ‘before-hack-local-variables-hook’
 ‘hack-local-variables-hook’
      SeeFile Local Variables.
 
 ‘buffer-access-fontify-functions’
      SeeLazy Properties.
 
 ‘buffer-list-update-hook’
      Hook run when the buffer list changes (SeeBuffer List).
 
 ‘buffer-quit-function’
      Function to call to quit the current buffer.
 
 ‘change-major-mode-hook’
      SeeCreating Buffer-Local.
 
 ‘command-line-functions’
      SeeCommand-Line Arguments.
 
 ‘delayed-warnings-hook’
      The command loop runs this soon after ‘post-command-hook’ (q.v.).
 
 ‘focus-in-hook’
 ‘focus-out-hook’
      SeeInput Focus.
 
 ‘delete-frame-functions’
      SeeDeleting Frames.
 
 ‘delete-terminal-functions’
      SeeMultiple Terminals.
 
 ‘pop-up-frame-function’
 ‘split-window-preferred-function’
      SeeChoosing Window Options.
 
 ‘echo-area-clear-hook’
      SeeEcho Area Customization.
 
 ‘find-file-hook’
 ‘find-file-not-found-functions’
      SeeVisiting Functions.
 
 ‘font-lock-extend-after-change-region-function’
      SeeRegion to Refontify.
 
 ‘font-lock-extend-region-functions’
      SeeMultiline Font Lock.
 
 ‘font-lock-fontify-buffer-function’
 ‘font-lock-fontify-region-function’
 ‘font-lock-mark-block-function’
 ‘font-lock-unfontify-buffer-function’
 ‘font-lock-unfontify-region-function’
      SeeOther Font Lock Variables.
 
 ‘fontification-functions’
      SeeAutomatic Face Assignment Auto Faces.
 
 ‘frame-auto-hide-function’
      SeeQuitting Windows.
 
 ‘kill-buffer-hook’
 ‘kill-buffer-query-functions’
      SeeKilling Buffers.
 
 ‘kill-emacs-hook’
 ‘kill-emacs-query-functions’
      SeeKilling Emacs.
 
 ‘menu-bar-update-hook’
      SeeMenu Bar.
 
 ‘minibuffer-setup-hook’
 ‘minibuffer-exit-hook’
      SeeMinibuffer Misc.
 
 ‘mouse-leave-buffer-hook’
      Hook run when about to switch windows with a mouse command.
 
 ‘mouse-position-function’
      SeeMouse Position.
 
 ‘prefix-command-echo-keystrokes-functions’
      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.  SeePrefix Command Arguments.
 
 ‘prefix-command-preserve-state-hook’
      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.
 
 ‘pre-redisplay-functions’
      Hook run in each window just before redisplaying it.  SeeForcing
      Redisplay.
 
 ‘post-command-hook’
 ‘pre-command-hook’
      SeeCommand Overview.
 
 ‘post-gc-hook’
      SeeGarbage Collection.
 
 ‘post-self-insert-hook’
      SeeKeymaps and Minor Modes.
 
 ‘suspend-hook’
 ‘suspend-resume-hook’
 ‘suspend-tty-functions’
 ‘resume-tty-functions’
      SeeSuspending Emacs.
 
 ‘syntax-begin-function’
 ‘syntax-propertize-extend-region-functions’
 ‘syntax-propertize-function’
 ‘font-lock-syntactic-face-function’
      SeeSyntactic Font Lock.  SeeSyntax Properties.
 
 ‘temp-buffer-setup-hook’
 ‘temp-buffer-show-function’
 ‘temp-buffer-show-hook’
      SeeTemporary Displays.
 
 ‘tty-setup-hook’
      SeeTerminal-Specific.
 
 ‘window-configuration-change-hook’
 ‘window-scroll-functions’
 ‘window-size-change-functions’
      SeeWindow Hooks.
 
 ‘window-text-change-functions’
      Functions to call in redisplay when text in the window might
      change.