Function: remove-function

remove-function is a macro defined in nadvice.el.gz.

Signature

(remove-function PLACE FUNCTION)

Documentation

Remove the FUNCTION piece of advice from PLACE.

If FUNCTION was not added to PLACE, do nothing. Instead of FUNCTION being the actual function, it can also be the name of the piece of advice.

View in manual

Probably introduced at or before Emacs version 24.4.

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/nadvice.el.gz
;;;###autoload
(defmacro remove-function (place function)
  "Remove the FUNCTION piece of advice from PLACE.
If FUNCTION was not added to PLACE, do nothing.
Instead of FUNCTION being the actual function, it can also be the `name'
of the piece of advice."
  (declare (debug ([&or symbolp ("local" form) ("var" sexp) gv-place]
                   form)))
  (gv-letplace (getter setter) (advice--normalize-place place)
    (macroexp-let2 nil new `(advice--remove-function ,getter ,function)
      `(unless (eq ,new ,getter) ,(funcall setter new)))))