Module Hook.Function

type 'a t
val sexp_of_t : ('a -> Ppx_sexp_conv_lib.Sexp.t) -> 'a t -> Ppx_sexp_conv_lib.Sexp.t
val create : Ecaml.Symbol.t -> Core_kernel.Source_code_position.t -> ?⁠docstring:string -> ?⁠should_profile:bool -> hook_type:'a Hook_type.t -> (unit, 'r) Ecaml.Defun.Returns.t -> ('a -> 'r) -> 'a t

create here return_type symbol f defines an emacs function named symbol that runs f when called. It returns an 'a t usable for modifying hooks.

val create_with_self : Ecaml.Symbol.t -> Core_kernel.Source_code_position.t -> ?⁠docstring:string -> hook_type:'a Hook_type.t -> (unit, 'r) Ecaml.Defun.Returns.t -> ('a t -> 'a -> 'r) -> 'a t

create_with_self here return_type symbol f works the same as create, except that the 'a t it returns is also passed as an argument to f.

This is useful, for example, if f wants to remove itself from a hook once it is called.