GNU bug report logs -
#13023
24.3.50; lexical binding does not work within defadvice
Previous Next
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 13023 in the body.
You can then email your comments to 13023 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#13023
; Package
emacs
.
(Wed, 28 Nov 2012 16:20:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Christopher Schmidt <christopher <at> ch.ristopher.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Wed, 28 Nov 2012 16:20:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
;; -*- 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:
Load test.elc? (y or n) y
Loading test.elc...
lex-bind works
Load error for test.elc:
(void-variable abc)
Christopher
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#13023
; Package
emacs
.
(Thu, 29 Nov 2012 04:35:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 13023 <at> debbugs.gnu.org (full text, mbox):
> ;; -*- 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.
Stefan
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#13023
; Package
emacs
.
(Thu, 29 Nov 2012 22:53:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 13023 <at> debbugs.gnu.org (full text, mbox):
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.
Would it be possible to fix this by defining a new primitive construct
for use in the constructed function that runs the advince?
--
Dr Richard Stallman
President, Free Software Foundation
51 Franklin St
Boston MA 02110
USA
www.fsf.org www.gnu.org
Skype: No way! That's nonfree (freedom-denying) software.
Use Ekiga or an ordinary phone call
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#13023
; Package
emacs
.
(Fri, 30 Nov 2012 03:48:02 GMT)
Full text and
rfc822 format available.
Message #14 received at 13023 <at> debbugs.gnu.org (full text, mbox):
> 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.
> Would it be possible to fix this by defining a new primitive construct
> for use in the constructed function that runs the advice?
I don't think there's a need to add any new primitive. If someone wants
to dig into advice.el to try and fix it, it can be fixed there (as
evidenced by advice-add).
I personally would rather tell people to use advice-add instead.
Stefan
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#13023
; Package
emacs
.
(Fri, 30 Nov 2012 20:14:02 GMT)
Full text and
rfc822 format available.
Message #17 received at 13023 <at> debbugs.gnu.org (full text, mbox):
I don't think there's a need to add any new primitive. If someone wants
to dig into advice.el to try and fix it, it can be fixed there (as
evidenced by advice-add).
I personally would rather tell people to use advice-add instead.
That would, in effect, be an incompatible change in interface.
Why make the change? Is there something wrong with defadvice?
--
Dr Richard Stallman
President, Free Software Foundation
51 Franklin St
Boston MA 02110
USA
www.fsf.org www.gnu.org
Skype: No way! That's nonfree (freedom-denying) software.
Use Ekiga or an ordinary phone call
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#13023
; Package
emacs
.
(Sat, 01 Dec 2012 04:26:02 GMT)
Full text and
rfc822 format available.
Message #20 received at 13023 <at> debbugs.gnu.org (full text, mbox):
> Is there something wrong with defadvice?
Yes: complexity. Compare nadvice.el and advice.el. Even after you
remove the long comment at the beginning, the difference in code size
speaks for itself.
Stefan
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#13023
; Package
emacs
.
(Sun, 02 Dec 2012 00:04:02 GMT)
Full text and
rfc822 format available.
Message #23 received at 13023 <at> debbugs.gnu.org (full text, mbox):
> Even after you
> remove the long comment at the beginning, the difference in code size
> speaks for itself.
Exactly 1,000 lines longer, after removing comments and blank lines:
1,305 vs 305.
(Bored, moi?)
Juanma
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#13023
; Package
emacs
.
(Sun, 02 Dec 2012 04:19:02 GMT)
Full text and
rfc822 format available.
Message #26 received at 13023 <at> debbugs.gnu.org (full text, mbox):
Yes: complexity. Compare nadvice.el and advice.el.
The main difference seems to me that part of the arguments of
advice.el get pushed into the function that you need to pass
to advice-add. So the complexity of using it is no more.
Also, you lose the ability to modify the argument values before
the advised function's body.
The doc string of advice-add is incomplete, so I cannot tell
what all its args mean or what it can really do.
--
Dr Richard Stallman
President, Free Software Foundation
51 Franklin St
Boston MA 02110
USA
www.fsf.org www.gnu.org
Skype: No way! That's nonfree (freedom-denying) software.
Use Ekiga or an ordinary phone call
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#13023
; Package
emacs
.
(Mon, 03 Dec 2012 00:05:02 GMT)
Full text and
rfc822 format available.
Message #29 received at 13023 <at> debbugs.gnu.org (full text, mbox):
Correction:
Yes: complexity. Compare nadvice.el and advice.el.
The main difference seems to me that part of the arguments of
advice.el get pushed into the function that you need to pass
to advice-add. So the complexity of using advice-add is no less.
Also, you lose the ability to modify the argument values before
the advised function's body.
The doc string of advice-add is incomplete, so I cannot tell
what all its args mean or what it can really do.
--
Dr Richard Stallman
President, Free Software Foundation
51 Franklin St
Boston MA 02110
USA
www.fsf.org www.gnu.org
Skype: No way! That's nonfree (freedom-denying) software.
Use Ekiga or an ordinary phone call
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#13023
; Package
emacs
.
(Tue, 02 Feb 2016 18:36:02 GMT)
Full text and
rfc822 format available.
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
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#13023
; Package
emacs
.
(Tue, 02 Feb 2016 19:43:01 GMT)
Full text and
rfc822 format available.
Message #35 received at 13023 <at> debbugs.gnu.org (full text, mbox):
> does the above mean that this bug should be closed?
To the extent that I don't know of anyone who intends to fix this
problem, I guess we could close it as "won't fix".
Stefan
Added tag(s) wontfix.
Request was from
Glenn Morris <rgm <at> gnu.org>
to
control <at> debbugs.gnu.org
.
(Tue, 02 Feb 2016 20:16:02 GMT)
Full text and
rfc822 format available.
bug closed, send any further explanations to
13023 <at> debbugs.gnu.org and Christopher Schmidt <christopher <at> ch.ristopher.com>
Request was from
Lars Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Sun, 28 Jul 2019 18:25:03 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Mon, 26 Aug 2019 11:24:05 GMT)
Full text and
rfc822 format available.
This bug report was last modified 5 years and 301 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.