bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#17348: 24.3.50; Cannot advice-add the same function :before and :aft


From: Stefan Monnier
Subject: bug#17348: 24.3.50; Cannot advice-add the same function :before and :after
Date: Sat, 26 Apr 2014 08:46:13 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux)

>   (advice-add 'yftest :before #'yfcheck)
>   (advice-add 'yftest :after #'yfcheck)

`advice-add' will not add the same function twice, indeed.
Similarly to `add-hook'.  This is done explicitly in advice--add-function:

    (when a
      ;; The advice is already present.  Remove the old one, first.
      (setf (gv-deref ref)
            (advice--remove-function (gv-deref ref) (advice--car a))))

I guess we could change that, but then the notion of "removal" becomes
more complicated.


        Stefan





reply via email to

[Prev in Thread] Current Thread [Next in Thread]