[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
bug#17348: 24.3.50; Cannot advice-add the same function :before and :after
Thu, 01 May 2014 16:47:20 -0400
Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux)
> 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
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).
- bug#17348: 24.3.50; Cannot advice-add the same function :before and :after,
Stefan Monnier <=