The "advice" feature lets you add to the existing definition of a function, by wrapping around the original function a "piece of advice".
Each piece of advice receives the original function and arguments; its result is returned to the caller as if from the original function.
A function may have multiple pieces of advice, which are composed by nesting earlier advice within later advice.
(Info-goto-node "(elisp)Advising Functions")
val add : ?docstring:string ‑> ?interactive:string ‑> Core_kernel.Source_code_position.t ‑> 'a Ecaml.Value.Type.t ‑> Ecaml.Symbol.t ‑> (inner:(Ecaml.Value.t list ‑> Ecaml.Value.t) ‑> inner_args:Ecaml.Value.t list ‑> 'a) ‑> for_function:Ecaml.Symbol.t ‑> unit
add ?docstring ?interactive here return_type advice_name f ~for_function
defines function advice_name
with body f
and adds it as advice on for_function
.
val add_predefined_function : Ecaml.Symbol.t ‑> for_function:Ecaml.Symbol.t ‑> unit
(describe-function 'advice-add)
val remove : Ecaml.Symbol.t ‑> for_function:Ecaml.Symbol.t ‑> unit
(describe-function 'advice-remove)