This is the standard type of hook, it is a variable whose value is a
list of functions. When the hook is evaluated each of the named functions
will be called in turn until one of them returns a value which is not
nil. This value becomes the value of the hook and no more of
the functions are called. If all of the functions in the hook return
nil the value of the hook is nil.
The names of hooks of this type will normally end in -hook.
If at-end is non-nil the new function is added at the end of
the hook's list of functions (and therefore will be called last when the
hook is evaluated), otherwise the new function is added to the front
of the list.
text-mode-hook
=> (fill-mode-on)
(add-hook 'text-mode-hook 'my-function)
=> (my-function fill-mode-on)
All instances of function are deleted from the hook.
text-mode-hook
=> (my-function fill-mode-on)
(remove-hook 'text-mode-hook 'my-function)
=> (fill-mode-on)
Each function stored in the hook is applied to the args in turn until
one returns non-nil. This non-nil value becomes the result
of the hook. If all functions return nil then the result of the
hook is nil.
Note that most functions which are installed in hooks should always return
nil to ensure that all the functions in the hook are evaluated.
Go to the first, previous, next, last section, table of contents.