Function: footnote--local-advice

footnote--local-advice is a macro defined in footnote.el.gz.

Signature

(footnote--local-advice MODE VARIABLE FUNCTION)

Documentation

Add advice to a variable holding buffer-local functions.

Typical use would be to advice variables like fill-paragraph-function from minor modes.

MODE is the minor mode symbol, VARIABLE is the variable to get advice, and FUNCTION is what'll be added as an :around advice.

Source Code

;; Defined in /usr/src/emacs/lisp/mail/footnote.el.gz
(defmacro footnote--local-advice (mode variable function)
  "Add advice to a variable holding buffer-local functions.
Typical use would be to advice variables like
`fill-paragraph-function' from minor modes.

MODE is the minor mode symbol, VARIABLE is the variable to get
advice, and FUNCTION is what'll be added as an :around advice."
  `(progn
     (unless ,variable
       ;; nil and `ignore' have the same semantics for adaptive-fill-function,
       ;; but only `ignore' behaves correctly with add/remove-function.
       (setq-local ,variable #'ignore))
     (remove-function (local ',variable) #',function)
     (when ,mode
       (add-function :around (local ',variable)
                     #',function))))