GNU bug report logs -
#13023
24.3.50; lexical binding does not work within defadvice
Previous Next
Full log
Message #32 received at 13023 <at> debbugs.gnu.org (full text, mbox):
On 2012-11-28, at 23:32, Stefan Monnier <monnier <at> iro.umontreal.ca> wrote:
>> ;; -*- lexical-binding: t -*-
>> (funcall (let ((rms "works"))
>> (lambda ()
>> (message "lex-bind %s" rms))))
>
>> (defun asdf (b) (funcall b))
>
>> (defadvice asdf (before rms (b) activate)
>> (setf b (let ((abc 1) (b b)) (lambda () (print abc) (funcall b)))))
>
>> (asdf 'ding)
>
>> I think this code should work fine. It doesn't work with trunk and
>> emacs-24, though:
>
> Indeed, it doesn't work. And because of the way advice.el works
> (building a new function by combining the code chunks from all the
> pieces of advice applied to that function) it's not easy to fix.
>
> This is partly related to the issue mentioned recently that macro calls
> in pieces of advice are expanded late (typically when the advised
> function is defined).
>
> BTW, this does not affect the new `advice-add' feature in Emacs trunk.
Hi Stefan,
hi all,
does the above mean that this bug should be closed? AFAIU, new code
should (at least usually) use advice-add, and while the "old" advice
system is not going to be deleted, it is kind of deprecated.
Best,
--
Marcin Borkowski
http://mbork.pl/en
This bug report was last modified 5 years and 341 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.