Hooks A hook is a variable where you can store a function or functions to be called on a particular occasion by an existing program. Emacs provides a number of hooks for the sake of customization. Most of the hooks in Emacs are normal hooks . These variables contain lists of functions to be called with no arguments. The reason most hooks are normal hooks is so that you can use them in a uniform way.
Most major modes run hooks as the last step of initialization.
This makes it easy for a user to customize the behavior of the mode, by overriding the local variable assignments already made by the mode. But hooks may also be used in other contexts. The recommended way to add a hook function to a normal hook is by calling add-hook . You can use any valid Lisp function as the hook function. The next example shows how to use a hook to customize the indentation of C code.