--- Begin Message ---
Subject: |
24.3.50; Cannot advice-add the same function :before and :after |
Date: |
Sat, 26 Apr 2014 13:16:00 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) |
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.
--- End Message ---
--- Begin Message ---
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 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux) |
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
--- End Message ---