GNU bug report logs - #17348
24.3.50; Cannot advice-add the same function :before and :after

Previous Next

Package: emacs;

Reported by: Nicolas Richard <theonewiththeevillook <at> yahoo.fr>

Date: Sat, 26 Apr 2014 11:17:02 UTC

Severity: minor

Found in version 24.3.50

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Nicolas Richard <theonewiththeevillook <at> yahoo.fr>
Cc: 17348 <at> debbugs.gnu.org
Subject: bug#17348: 24.3.50; Cannot advice-add the same function :before and :after
Date: Sat, 26 Apr 2014 08:46:13 -0400
>   (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




This bug report was last modified 11 years and 10 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.