all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: 13023@debbugs.gnu.org
Subject: bug#13023: 24.3.50; lexical binding does not work within defadvice
Date: Wed, 28 Nov 2012 23:32:36 -0500	[thread overview]
Message-ID: <jwv624p58yg.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <87zk213do1@ch.ristopher.com> (Christopher Schmidt's message of "Wed, 28 Nov 2012 16:17:17 +0000 (GMT)")

>     ;; -*- 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





  reply	other threads:[~2012-11-29  4:32 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-28 16:17 bug#13023: 24.3.50; lexical binding does not work within defadvice Christopher Schmidt
2012-11-29  4:32 ` Stefan Monnier [this message]
2012-11-29 22:50   ` Richard Stallman
2012-11-30  3:45     ` Stefan Monnier
2012-11-30 20:11       ` Richard Stallman
2012-12-01  4:23         ` Stefan Monnier
2012-12-02  0:00           ` Juanma Barranquero
2012-12-02  4:15           ` Richard Stallman
2012-12-03  0:01             ` Richard Stallman
2016-02-02 18:35 ` Marcin Borkowski
2016-02-02 19:42   ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwv624p58yg.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=13023@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.