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: Thu, 01 May 2014 16:47:20 -0400
> 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.

> OTOH I also think that the current behaviour is fine, but I'd suggest
> emitting a warning when an advice is being overwritten/removed that way.

It's not meant to be a "secret" behavior, so people should be able to
rely on this behavior (just like you can rely on add-hook being
idempotent) and use it, in which case emitting a warning is
not appropriate.

This said, maybe we should make it easier to do what you wanted.
E.g. we could probably make it possible to use different `name'
properties to let a user add a function several times (potentially at
different places, but even at the same place).


        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.