GNU Info

Info Node: (librep.info)Normal Hooks

(librep.info)Normal Hooks


Prev: Functions As Hooks Up: Hooks
Enter node , (file) or (file)node

Normal Hooks
------------

   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 functions
will be called in turn.

   The names of hooks of this type will normally end in `-hook'.

   These functions are exported by the `rep.system' module.

 - Function: add-hook hook function #!optional at-end
     This function adds a new function FUNCTION to the list of
     functions installed in the (list) hook HOOK (a symbol).

     If AT-END is true 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
              => (#<closure fill-mode-on>)
          (add-hook 'text-mode-hook my-function)
              => (#<closure my-function> #<closure fill-mode-on>)

 - Function: remove-hook hook function
     This function removes the function FUNCTION from the list of
     functions stored in the (list) hook HOOK (a symbol).

     _All_ instances of FUNCTION are deleted from the hook.

   There are actually three calling conventions for this type of hook,
differing in how many of the functions in the list actually get called.
In this simplest form, _all_ functions are called. In an `and' type
hook, functions are only invoked while all others have returned true.
As soon as the first function in the hook returns false, no others will
be called. Finally, an `or' type hook aborts when a function returns a
true result.

 - Function: call-hook hook arg-list #!optional type
     Call the hook named by the symbol HOOK, passing all functions the
     arguments in the list ARG-LIST. Note that HOOK may also be the
     actual list of functions to call.

     TYPE defines how the return values of each function in the hook
     are treated. If TYPE is false they are ignored, if TYPE is the
     symbol `and' the hook aborts after a function returns false, if
     TYPE is `or' the hook aborts when a function returns true.

     In all cases the value returned by the last-evaluated function is
     returned.


automatically generated by info2www version 1.2.2.9