From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Marcin Borkowski Newsgroups: gmane.emacs.bugs Subject: bug#13023: 24.3.50; lexical binding does not work within defadvice Date: Tue, 02 Feb 2016 19:35:35 +0100 Message-ID: <87io27dkp4.fsf@mbork.pl> References: <87zk213do1@ch.ristopher.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1454438185 19566 80.91.229.3 (2 Feb 2016 18:36:25 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 2 Feb 2016 18:36:25 +0000 (UTC) Cc: 13023@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Feb 02 19:36:13 2016 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 1aQfoB-0001Lx-TV for geb-bug-gnu-emacs@m.gmane.org; Tue, 02 Feb 2016 19:36:12 +0100 Original-Received: from localhost ([::1]:58951 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aQfoB-0001Ru-BN for geb-bug-gnu-emacs@m.gmane.org; Tue, 02 Feb 2016 13:36:11 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41157) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aQfo7-0001Rn-ML for bug-gnu-emacs@gnu.org; Tue, 02 Feb 2016 13:36:08 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aQfo2-0006Fe-Iv for bug-gnu-emacs@gnu.org; Tue, 02 Feb 2016 13:36:07 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:48457) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aQfo2-0006Fa-Ey for bug-gnu-emacs@gnu.org; Tue, 02 Feb 2016 13:36:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84) (envelope-from ) id 1aQfo2-0008Az-8R for bug-gnu-emacs@gnu.org; Tue, 02 Feb 2016 13:36:02 -0500 X-Loop: help-debbugs@gnu.org In-Reply-To: <87zk213do1@ch.ristopher.com> Resent-From: Marcin Borkowski Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 02 Feb 2016 18:36:02 +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.145443814931409 (code B ref 13023); Tue, 02 Feb 2016 18:36:02 +0000 Original-Received: (at 13023) by debbugs.gnu.org; 2 Feb 2016 18:35:49 +0000 Original-Received: from localhost ([127.0.0.1]:57046 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aQfnp-0008AX-5S for submit@debbugs.gnu.org; Tue, 02 Feb 2016 13:35:49 -0500 Original-Received: from mail.mojserwer.eu ([195.110.48.8]:59144) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aQfnn-0008AM-0S for 13023@debbugs.gnu.org; Tue, 02 Feb 2016 13:35:47 -0500 Original-Received: from localhost (localhost [127.0.0.1]) by mail.mojserwer.eu (Postfix) with ESMTP id 771329D2002; Tue, 2 Feb 2016 19:35:45 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at mail.mojserwer.eu Original-Received: from mail.mojserwer.eu ([127.0.0.1]) by localhost (mail.mojserwer.eu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id leFEikQcT+vf; Tue, 2 Feb 2016 19:35:43 +0100 (CET) Original-Received: from localhost (unknown [109.232.24.28]) by mail.mojserwer.eu (Postfix) with ESMTPSA id 2AF0A9D2001; Tue, 2 Feb 2016 19:35:41 +0100 (CET) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.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:112285 Archived-At: On 2012-11-28, at 23:32, Stefan Monnier 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