From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#13023: 24.3.50; lexical binding does not work within defadvice Date: Wed, 28 Nov 2012 23:32:36 -0500 Message-ID: References: <87zk213do1@ch.ristopher.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1354163593 3044 80.91.229.3 (29 Nov 2012 04:33:13 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 29 Nov 2012 04:33:13 +0000 (UTC) To: 13023@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Nov 29 05:33:25 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TdvoM-0008NG-Sv for geb-bug-gnu-emacs@m.gmane.org; Thu, 29 Nov 2012 05:33:19 +0100 Original-Received: from localhost ([::1]:59450 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TdvoB-0007Mc-Lj for geb-bug-gnu-emacs@m.gmane.org; Wed, 28 Nov 2012 23:33:07 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:43643) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tdvo9-0007MT-2i for bug-gnu-emacs@gnu.org; Wed, 28 Nov 2012 23:33:05 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Tdvo8-0006aW-1e for bug-gnu-emacs@gnu.org; Wed, 28 Nov 2012 23:33:05 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:34172) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tdvo7-0006aS-Ux for bug-gnu-emacs@gnu.org; Wed, 28 Nov 2012 23:33:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1Tdvq1-0003Jl-Gs for bug-gnu-emacs@gnu.org; Wed, 28 Nov 2012 23:35:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 29 Nov 2012 04:35:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13023 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 13023-submit@debbugs.gnu.org id=B13023.135416367612722 (code B ref 13023); Thu, 29 Nov 2012 04:35:01 +0000 Original-Received: (at 13023) by debbugs.gnu.org; 29 Nov 2012 04:34:36 +0000 Original-Received: from localhost ([127.0.0.1]:44423 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Tdvpc-0003J9-AM for submit@debbugs.gnu.org; Wed, 28 Nov 2012 23:34:36 -0500 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.182]:23341) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Tdvpb-0003J3-Fr for 13023@debbugs.gnu.org; Wed, 28 Nov 2012 23:34:35 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ai0FAG6Zu09FxKh9/2dsb2JhbABEsEiDSYEIghUBAQQBVigLCzQSFBgNiEAFugmNJoMeA4hCmnGBWIMH X-IronPort-AV: E=Sophos;i="4.75,637,1330923600"; d="scan'208";a="208722636" Original-Received: from 69-196-168-125.dsl.teksavvy.com (HELO pastel.home) ([69.196.168.125]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 28 Nov 2012 23:32:37 -0500 Original-Received: by pastel.home (Postfix, from userid 20848) id BB7FA58B5B; Wed, 28 Nov 2012 23:32:36 -0500 (EST) In-Reply-To: <87zk213do1@ch.ristopher.com> (Christopher Schmidt's message of "Wed, 28 Nov 2012 16:17:17 +0000 (GMT)") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:67578 Archived-At: > ;; -*- 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