<!doctypehtml PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><meta content="text/html; charset=utf-8"http-equiv=content-type><link href=mailto:bug-gnu-emacs@gnu.org rev=made><link href=/graphics/gnu-head-mini.png rel=icon type=image/png><meta content=42.256233,-71.006581 name=ICBM><meta content=gnu.org name=DC.title><style>@import url('/software/emacs/manual.css');</style><body lang=en><span id=Standard-Hooks> </span><div class=header style=background-color:#DDDDFF><p>Next: <a accesskey=n href=Index.html rel=next> Index </a> , Previous: <a accesskey=p href=Standard-Keymaps.html rel=prev> Standard Keymaps </a> , Up: <a accesskey=u href=index.html rel=up> Top </a>   [ <a title="Table of contents"href=index.html#SEC_Contents rel=contents> Contents </a> ][ <a href=Index.html rel=index title=Index> Index </a> ]</div><span id=Standard-Hooks-1> </span><h2 class=appendix>Appendix H Standard Hooks</h2><span id=index-standard-hooks> </span><span id=index-hook-variables_002c-list-of> </span><p>The following is a list of some hook variables that let you provide functions to be called from within Emacs on suitable occasions.<p>Most of these variables have names ending with ‘ <samp> -hook </samp> ’. They are <em> normal hooks </em> , run by means of <code>
    run-hooks
   </code> . 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
   </code> . See <a href=Hooks.html> Hooks </a> , for more information about using hooks.<p>The variables whose names end in ‘ <samp> -functions </samp> ’ are usually <em> abnormal hooks </em> (some old code may also use the deprecated ‘ <samp> -hooks </samp> ’ 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 </samp> ’ have single functions as their values.<p>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 </var> -mode-hook </samp> ’. The major mode command runs this normal hook with <code>
    run-mode-hooks
   </code> as the very last thing it does. See <a href=Mode-Hooks.html> Mode Hooks </a> . Most minor modes have mode hooks too.<p>A special feature allows you to specify expressions to evaluate if and when a file is loaded (see <a href=Hooks-for-Loading.html> Hooks for Loading </a> ). That feature is not exactly a hook, but does a similar job.<dl compact=compact><dt><code>
     activate-mark-hook
    </code><dt><code>
     deactivate-mark-hook
    </code><dd><p>See <a href=The-Mark.html> The Mark </a> .</p><dt><code>
     after-change-functions
    </code><dt><code>
     before-change-functions
    </code><dt><code>
     first-change-hook
    </code><dd><p>See <a href=Change-Hooks.html> Change Hooks </a> .</p><dt><code>
     after-change-major-mode-hook
    </code><dt><code>
     change-major-mode-after-body-hook
    </code><dd><p>See <a href=Mode-Hooks.html> Mode Hooks </a> .</p><dt><code>
     after-init-hook
    </code><dt><code>
     before-init-hook
    </code><dt><code>
     emacs-startup-hook
    </code><dt><code>
     window-setup-hook
    </code><dd><p>See <a href=Init-File.html> Init File </a> .</p><dt><code>
     after-insert-file-functions
    </code><dt><code>
     write-region-annotate-functions
    </code><dt><code>
     write-region-post-annotation-function
    </code><dd><p>See <a href=Format-Conversion.html> Format Conversion </a> .</p><dt><code>
     after-make-frame-functions
    </code><dt><code>
     before-make-frame-hook
    </code><dt><code>
     server-after-make-frame-hook
    </code><dd><p>See <a href=Creating-Frames.html> Creating Frames </a> .</p><dt><code>
     after-save-hook
    </code><dt><code>
     before-save-hook
    </code><dt><code>
     write-contents-functions
    </code><dt><code>
     write-file-functions
    </code><dd><p>See <a href=Saving-Buffers.html> Saving Buffers </a> .</p><dt><code>
     after-setting-font-hook
    </code><dd><span id=index-after_002dsetting_002dfont_002dhook> </span> <p>Hook run after a frame’s font changes.</p><dt><code>
     auto-save-hook
    </code><dd><p>See <a href=Auto_002dSaving.html> Auto-Saving </a> .</p><dt><code>
     before-hack-local-variables-hook
    </code><dt><code>
     hack-local-variables-hook
    </code><dd><p>See <a href=File-Local-Variables.html> File Local Variables </a> .</p><dt><code>
     buffer-access-fontify-functions
    </code><dd><p>See <a href=Lazy-Properties.html> Lazy Properties </a> .</p><dt><code>
     buffer-list-update-hook
    </code><dd><span id=index-buffer_002dlist_002dupdate_002dhook-1> </span> <p>Hook run when the buffer list changes (see <a href=Buffer-List.html> Buffer List </a> ).</p><dt><code>
     buffer-quit-function
    </code><dd><span id=index-buffer_002dquit_002dfunction> </span> <p>Function to call to quit the current buffer.</p><dt><code>
     change-major-mode-hook
    </code><dd><p>See <a href=Creating-Buffer_002dLocal.html> Creating Buffer-Local </a> .</p><dt><code>
     comint-password-function
    </code><dd><p>This abnormal hook permits a derived mode to supply a password for the underlying command interpreter without prompting the user.</p><dt><code>
     command-line-functions
    </code><dd><p>See <a href=Command_002dLine-Arguments.html> Command-Line Arguments </a> .</p><dt><code>
     delayed-warnings-hook
    </code><dd><span id=index-delayed_002dwarnings_002dhook-1> </span> <p>The command loop runs this soon after <code>
      post-command-hook
     </code> (q.v.).</p><dt><code>
     focus-in-hook
    </code><dd><span id=index-focus_002din_002dhook> </span><dt><code>
     focus-out-hook
    </code><dd><span id=index-focus_002dout_002dhook> </span> <p>See <a href=Input-Focus.html> Input Focus </a> .</p><dt><code>
     delete-frame-functions
    </code><dt><code>
     after-delete-frame-functions
    </code><dd><p>See <a href=Deleting-Frames.html> Deleting Frames </a> .</p><dt><code>
     delete-terminal-functions
    </code><dd><p>See <a href=Multiple-Terminals.html> Multiple Terminals </a> .</p><dt><code>
     pop-up-frame-function
    </code><dt><code>
     split-window-preferred-function
    </code><dd><p>See <a href=Choosing-Window-Options.html> Choosing Window Options </a> .</p><dt><code>
     echo-area-clear-hook
    </code><dd><p>See <a href=Echo-Area-Customization.html> Echo Area Customization </a> .</p><dt><code>
     find-file-hook
    </code><dt><code>
     find-file-not-found-functions
    </code><dd><p>See <a href=Visiting-Functions.html> Visiting Functions </a> .</p><dt><code>
     font-lock-extend-after-change-region-function
    </code><dd><p>See <a href=Region-to-Refontify.html> Region to Refontify </a> .</p><dt><code>
     font-lock-extend-region-functions
    </code><dd><p>See <a href=Multiline-Font-Lock.html> Multiline Font Lock </a> .</p><dt><code>
     font-lock-fontify-buffer-function
    </code><dt><code>
     font-lock-fontify-region-function
    </code><dt><code>
     font-lock-mark-block-function
    </code><dt><code>
     font-lock-unfontify-buffer-function
    </code><dt><code>
     font-lock-unfontify-region-function
    </code><dd><p>See <a href=Other-Font-Lock-Variables.html> Other Font Lock Variables </a> .</p><dt><code>
     fontification-functions
    </code><dd><p>See <a href=Auto-Faces.html> Automatic Face Assignment </a> .</p><dt><code>
     frame-auto-hide-function
    </code><dd><p>See <a href=Quitting-Windows.html> Quitting Windows </a> .</p><dt><code>
     quit-window-hook
    </code><dd><p>See <a href=Quitting-Windows.html> Quitting Windows </a> .</p><dt><code>
     kill-buffer-hook
    </code><dt><code>
     kill-buffer-query-functions
    </code><dd><p>See <a href=Killing-Buffers.html> Killing Buffers </a> .</p><dt><code>
     kill-emacs-hook
    </code><dt><code>
     kill-emacs-query-functions
    </code><dd><p>See <a href=Killing-Emacs.html> Killing Emacs </a> .</p><dt><code>
     menu-bar-update-hook
    </code><dd><p>See <a href=Menu-Bar.html> Menu Bar </a> .</p><dt><code>
     minibuffer-setup-hook
    </code><dt><code>
     minibuffer-exit-hook
    </code><dd><p>See <a href=Minibuffer-Misc.html> Minibuffer Misc </a> .</p><dt><code>
     mouse-leave-buffer-hook
    </code><dd><span id=index-mouse_002dleave_002dbuffer_002dhook> </span> <p>Hook run when about to switch windows with a mouse command.</p><dt><code>
     mouse-position-function
    </code><dd><p>See <a href=Mouse-Position.html> Mouse Position </a> .</p><dt><code>
     prefix-command-echo-keystrokes-functions
    </code><dd><span id=index-prefix_002dcommand_002decho_002dkeystrokes_002dfunctions> </span> <p>An abnormal hook run by prefix commands (such as <kbd> C-u </kbd> ) which should return a string describing the current prefix state. For example, <kbd> C-u </kbd> produces ‘ <samp> C-u- </samp> ’ and ‘ <samp> C-u 1 2 3- </samp> ’. Each hook function is called with no arguments and should return a string describing the current prefix state, or <code>
      nil
     </code> if there’s no prefix state. See <a href=Prefix-Command-Arguments.html> Prefix Command Arguments </a> .</p><dt><code>
     prefix-command-preserve-state-hook
    </code><dd><span id=index-prefix_002dcommand_002dpreserve_002dstate_002dhook> </span> <p>Hook run when a prefix command needs to preserve the prefix by passing the current prefix command state to the next command. For example, <kbd> C-u </kbd> needs to pass the state to the next command when the user types <kbd> C-u - </kbd> or follows <kbd> C-u </kbd> with a digit.</p><dt><code>
     pre-redisplay-functions
    </code><dd><p>Hook run in each window just before redisplaying it. See <a href=Forcing-Redisplay.html> Forcing Redisplay </a> .</p><dt><code>
     post-command-hook
    </code><dt><code>
     pre-command-hook
    </code><dd><p>See <a href=Command-Overview.html> Command Overview </a> .</p><dt><code>
     post-gc-hook
    </code><dd><p>See <a href=Garbage-Collection.html> Garbage Collection </a> .</p><dt><code>
     post-self-insert-hook
    </code><dd><p>See <a href=Keymaps-and-Minor-Modes.html> Keymaps and Minor Modes </a> .</p><dt><code>
     suspend-hook
    </code><dt><code>
     suspend-resume-hook
    </code><dt><code>
     suspend-tty-functions
    </code><dt><code>
     resume-tty-functions
    </code><dd><p>See <a href=Suspending-Emacs.html> Suspending Emacs </a> .</p><dt><code>
     syntax-begin-function
    </code><dt><code>
     syntax-propertize-extend-region-functions
    </code><dt><code>
     syntax-propertize-function
    </code><dt><code>
     font-lock-syntactic-face-function
    </code><dd><p>See <a href=Syntactic-Font-Lock.html> Syntactic Font Lock </a> . See <a href=Syntax-Properties.html> Syntax Properties </a> .</p><dt><code>
     temp-buffer-setup-hook
    </code><dt><code>
     temp-buffer-show-function
    </code><dt><code>
     temp-buffer-show-hook
    </code><dd><p>See <a href=Temporary-Displays.html> Temporary Displays </a> .</p><dt><code>
     tty-setup-hook
    </code><dd><p>See <a href=Terminal_002dSpecific.html> Terminal-Specific </a> .</p><dt><code>
     window-configuration-change-hook
    </code><dt><code>
     window-scroll-functions
    </code><dt><code>
     window-size-change-functions
    </code><dd><p>See <a href=Window-Hooks.html> Window Hooks </a> .</p></dl><div class=header style=background-color:#DDDDFF><p>Next: <a accesskey=n href=Index.html rel=next> Index </a> , Previous: <a accesskey=p href=Standard-Keymaps.html rel=prev> Standard Keymaps </a> , Up: <a accesskey=u href=index.html rel=up> Top </a>   [ <a title="Table of contents"href=index.html#SEC_Contents rel=contents> Contents </a> ][ <a href=Index.html rel=index title=Index> Index </a> ]</div>