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 hooks for the sake of customization.
Hooks installed through Ecaml are wrapped in an exception handler that prints the
error to the *Messages*
buffer and exits the function normally.
(Info-goto-node "(elisp)Hooks")
include sig ... end
val sexp_of_t : ('a ‑> Sexplib.Sexp.t) ‑> 'a t ‑> Sexplib.Sexp.t
module Type : sig ... end
val create : 'a Type.t ‑> Ecaml.Symbol.t ‑> 'a t
val var : _ t ‑> Ecaml.Function.t list Ecaml.Var.t
module Where : sig ... end
module Function : sig ... end
val add : ?buffer_local:bool ‑> ?where:Where.t ‑> 'a t ‑> 'a Function.t ‑> unit
(describe-function 'add-hook)
(Info-goto-node "(elisp)Setting Hooks")
val remove : 'a t ‑> 'a Function.t ‑> unit
(describe-function 'remove-hook)
(Info-goto-node "(elisp)Setting Hooks")
val clear : _ t ‑> unit
val after_load_once : file ‑> unit
after_load_once f
adds f
to after_load
, and then removes it when it runs,
so that f
only runs once.