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: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Nicolas Richard <theonewiththeevillook <at> yahoo.fr>
Subject: bug#17348: closed (Re: bug#17348: 24.3.50; Cannot advice-add the
 same function :before and :after)
Date: Sat, 10 May 2014 20:10:03 +0000
[Message part 1 (text/plain, inline)]
Your bug report

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

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 17348 <at> debbugs.gnu.org.

-- 
17348: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=17348
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Nicolas Richard <theonewiththeevillook <at> yahoo.fr>
Cc: 17348-done <at> debbugs.gnu.org
Subject: Re: bug#17348: 24.3.50;
 Cannot advice-add the same function :before and :after
Date: Sat, 10 May 2014 16:09:21 -0400
I installed a patch in `emacs-24' which will let you add the same
function multiple times, as long as you specify different `name'
properties for each one.

>> In the actual situation that lead me to adding the same function twice,
>> it was a tracing function, like (message "time: %s ; value of
>> foovariable: %s" (current-time) foovariable) and I assumed that I would
>> be able to remove them both with one (advice-remove ...) -- I guess that
>> isn't too complicated.
> Removing them both would not be desirable in general.

With the new code, you can remove each one individually by specifying
its `name', or you can remove them all by specifying the function itself.


        Stefan

[Message part 3 (message/rfc822, inline)]
From: Nicolas Richard <theonewiththeevillook <at> yahoo.fr>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.3.50; Cannot advice-add the same function :before and :after
Date: Sat, 26 Apr 2014 13:16:00 +0200
Evalling:
(progn
  (defun yfcheck () (message "Check"))
  (defun yftest () (message "Test"))
  (advice-add 'yftest :before #'yfcheck)
  (advice-add 'yftest :after #'yfcheck)
  (yftest)
  nil)

gives (in the *Messages* buffer)
Test
Check

I'd have expected:
Check
Test
Check

-- 
Nico.



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

Previous Next


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