GNU bug report logs - #20139
25.0.50; eval-buffer ignores lexical-binding

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Jorgen Schaefer <contact@HIDDEN>; merged with #15070; dated Wed, 18 Mar 2015 22:10:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.
Merged 15070 20139. Request was from Glenn Morris <rgm@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 20139 <at> debbugs.gnu.org:


Received: (at 20139) by debbugs.gnu.org; 19 Mar 2015 15:49:22 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Mar 19 11:49:22 2015
Received: from localhost ([127.0.0.1]:53200 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1YYchG-00004z-1Q
	for submit <at> debbugs.gnu.org; Thu, 19 Mar 2015 11:49:22 -0400
Received: from fencepost.gnu.org ([208.118.235.10]:60729)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <rgm@HIDDEN>) id 1YYchE-00004s-F0
 for 20139 <at> debbugs.gnu.org; Thu, 19 Mar 2015 11:49:20 -0400
Received: from rgm by fencepost.gnu.org with local (Exim 4.71)
 (envelope-from <rgm@HIDDEN>)
 id 1YYchC-0001KO-4L; Thu, 19 Mar 2015 11:49:18 -0400
From: Glenn Morris <rgm@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
Subject: Re: bug#20139: 25.0.50; eval-buffer ignores lexical-binding
References: <87d2466jr3.fsf@HIDDEN>
 <jwvk2yd8z2a.fsf-monnier+emacsbugs@HIDDEN>
X-Spook: president passwd AIEWS Axis of Evil Saddam Hussein Forte
X-Ran: FhU1q{86Yo(Ht`NM-%&Fx;b>>FsYeh`*LQDJ;O7;zzOZoIY?aXhCi"`V|M(aKI^,XFhE]S
X-Hue: magenta
X-Debbugs-No-Ack: yes
X-Attribution: GM
Date: Thu, 19 Mar 2015 11:49:17 -0400
Message-ID: <dud245c7ia.fsf@HIDDEN>
User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Spam-Score: -5.0 (-----)
X-Debbugs-Envelope-To: 20139
Cc: Jorgen Schaefer <contact@HIDDEN>, 20139 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -5.0 (-----)

Stefan Monnier wrote:

> You can do M-: (setq lexical-binding t) from that buffer in order to
> tell Emacs that the code in the buffer uses the lexical

Apparently that doesn't work: http://debbugs.gnu.org/15070




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#20139; Package emacs. Full text available.

Message received at 20139 <at> debbugs.gnu.org:


Received: (at 20139) by debbugs.gnu.org; 19 Mar 2015 14:52:17 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Mar 19 10:52:17 2015
Received: from localhost ([127.0.0.1]:53175 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1YYbo0-00079M-Ld
	for submit <at> debbugs.gnu.org; Thu, 19 Mar 2015 10:52:16 -0400
Received: from loki.jorgenschaefer.de ([87.230.15.51]:38305)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <contact@HIDDEN>) id 1YYbny-00079D-IM
 for 20139 <at> debbugs.gnu.org; Thu, 19 Mar 2015 10:52:15 -0400
Received: from mail-wi0-f175.google.com (mail-wi0-f175.google.com
 [209.85.212.175])
 by loki.jorgenschaefer.de (Postfix) with ESMTPSA id 7E14A202042
 for <20139 <at> debbugs.gnu.org>; Thu, 19 Mar 2015 15:52:11 +0100 (CET)
Received: by wibg7 with SMTP id g7so10967452wib.1
 for <20139 <at> debbugs.gnu.org>; Thu, 19 Mar 2015 07:52:11 -0700 (PDT)
MIME-Version: 1.0
X-Received: by 10.181.5.43 with SMTP id cj11mr16676634wid.61.1426776731294;
 Thu, 19 Mar 2015 07:52:11 -0700 (PDT)
Received: by 10.27.83.82 with HTTP; Thu, 19 Mar 2015 07:52:11 -0700 (PDT)
In-Reply-To: <jwvmw3959zl.fsf-monnier+emacsbugs@HIDDEN>
References: <87d2466jr3.fsf@HIDDEN>
 <jwvk2yd8z2a.fsf-monnier+emacsbugs@HIDDEN>
 <CALqDrScO=xe4bBTmE2YqGfH+PG8bqpmJ_d5iq4G6VwOt_Qp4vA@HIDDEN>
 <87bnjpgvje.fsf@HIDDEN>
 <jwvzj795b2l.fsf-monnier+emacsbugs@HIDDEN>
 <CALqDrSccFR=TMo=r96v_ODCJbq=afrcaXCse77shekyRWwEyxA@HIDDEN>
 <jwvmw3959zl.fsf-monnier+emacsbugs@HIDDEN>
Date: Thu, 19 Mar 2015 15:52:11 +0100
Message-ID: <CALqDrSfa=tzYrybZdP7Xsgh5dhnobCSo6Y4=B31Lsy10HSSJNg@HIDDEN>
Subject: Re: bug#20139: 25.0.50; eval-buffer ignores lexical-binding
From: =?UTF-8?Q?Jorgen_Sch=C3=A4fer?= <contact@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>, 20139 <at> debbugs.gnu.org
Content-Type: text/plain; charset=UTF-8
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 20139
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)

On Thu, Mar 19, 2015 at 3:40 PM, Stefan Monnier
<monnier@HIDDEN> wrote:
>> I am extracting Emacs Lisp code from a markdown file and evaluating
>> it. I can easily use eval-region instead of eval-buffer, so I have no
>> unsolved problem at the moment. Just figured I'd report this issue.
>
> The basic rule for me is "never (setq lexical-binding ...)".  Instead,
> either add the file-local magic marker and manipulate it as a whole
> buffer/file, or let-bind lexical-binding around the call to
> `eval-region', or pass the second arg to `eval'.

Let-binding `lexical-binding' does not affect `eval-buffer', either.

(with-temp-buffer
  (let ((lexical-binding t))
    (insert "(message \"%S\" (lambda () t))")
    (eval-buffer)
    (eval-region (point-min) (point-max))))

(lambda nil t)
(closure (t) nil t)

Regards,
Jorgen




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#20139; Package emacs. Full text available.

Message received at 20139 <at> debbugs.gnu.org:


Received: (at 20139) by debbugs.gnu.org; 19 Mar 2015 14:15:35 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Mar 19 10:15:35 2015
Received: from localhost ([127.0.0.1]:53145 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1YYbEU-00069U-LM
	for submit <at> debbugs.gnu.org; Thu, 19 Mar 2015 10:15:34 -0400
Received: from chene.dit.umontreal.ca ([132.204.246.20]:60082)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <monnier@HIDDEN>) id 1YYbER-00069H-2s
 for 20139 <at> debbugs.gnu.org; Thu, 19 Mar 2015 10:15:32 -0400
Received: from pastel.home (lechon.iro.umontreal.ca [132.204.27.242])
 by chene.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id t2JEFTQt025061;
 Thu, 19 Mar 2015 10:15:29 -0400
Received: by pastel.home (Postfix, from userid 20848)
 id 1C94518B6; Thu, 19 Mar 2015 10:15:29 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: Nicolas Richard <theonewiththeevillook@HIDDEN>
Subject: Re: bug#20139: 25.0.50; eval-buffer ignores lexical-binding
Message-ID: <jwvzj795b2l.fsf-monnier+emacsbugs@HIDDEN>
References: <87d2466jr3.fsf@HIDDEN>
 <jwvk2yd8z2a.fsf-monnier+emacsbugs@HIDDEN>
 <CALqDrScO=xe4bBTmE2YqGfH+PG8bqpmJ_d5iq4G6VwOt_Qp4vA@HIDDEN>
 <87bnjpgvje.fsf@HIDDEN>
Date: Thu, 19 Mar 2015 10:15:29 -0400
In-Reply-To: <87bnjpgvje.fsf@HIDDEN> (Nicolas Richard's message of "Thu, 19
 Mar 2015 10:56:37 +0100")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-NAI-Spam-Flag: NO
X-NAI-Spam-Level: 
X-NAI-Spam-Threshold: 5
X-NAI-Spam-Score: 0.2
X-NAI-Spam-Rules: 2 Rules triggered
	GEN_SPAM_FEATRE=0.2, RV5250=0
X-NAI-Spam-Version: 2.3.0.9393 : core <5250> : inlines <2442> : streams
 <1408075> : uri <1884670>
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: 20139
Cc: Jorgen =?windows-1252?Q?Sch=E4fer?= <contact@HIDDEN>,
 20139 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.3 (-)

> IOW eval-buffer obeys the "file"-local variable by calling
>     specbind (Qlexical_binding, lisp_file_lexically_bound_p (buf) ? Qt : Qnil);
> while eval-region simply uses the current value of lexical-binding.

Indeed, and I don't think we can easily change either of these.
Jorgen, what is the original problem you're trying to solve?


        Stefan




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#20139; Package emacs. Full text available.

Message received at 20139 <at> debbugs.gnu.org:


Received: (at 20139) by debbugs.gnu.org; 19 Mar 2015 09:56:52 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Mar 19 05:56:52 2015
Received: from localhost ([127.0.0.1]:52484 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1YYXC8-0006pn-0A
	for submit <at> debbugs.gnu.org; Thu, 19 Mar 2015 05:56:52 -0400
Received: from mxin.ulb.ac.be ([164.15.128.112]:15348)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <theonewiththeevillook@HIDDEN>) id 1YYXC5-0006pe-67
 for 20139 <at> debbugs.gnu.org; Thu, 19 Mar 2015 05:56:50 -0400
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: AuEFAL+cClWkD4Xx/2dsb2JhbABchDKDDa9nAQEBAQEBBpkJAoIUAQEBAQEBfYQQAQUjVhAIAxoCBSECAg8BBEkTiBoBFLFUgWuUDwGGBwEBAQEGAQEBAR6BIYRpgi2CYIQ+MweCaIFFBZo2hnSNNCKDbz0xgkMBAQE
Received: from mathsrv4.ulb.ac.be (HELO localhost) ([164.15.133.241])
 by smtp.ulb.ac.be with ESMTP; 19 Mar 2015 10:55:39 +0100
From: Nicolas Richard <theonewiththeevillook@HIDDEN>
To: Jorgen =?utf-8?Q?Sch=C3=A4fer?= <contact@HIDDEN>
Subject: Re: bug#20139: 25.0.50; eval-buffer ignores lexical-binding
References: <87d2466jr3.fsf@HIDDEN>
 <jwvk2yd8z2a.fsf-monnier+emacsbugs@HIDDEN>
 <CALqDrScO=xe4bBTmE2YqGfH+PG8bqpmJ_d5iq4G6VwOt_Qp4vA@HIDDEN>
Date: Thu, 19 Mar 2015 10:56:37 +0100
In-Reply-To: <CALqDrScO=xe4bBTmE2YqGfH+PG8bqpmJ_d5iq4G6VwOt_Qp4vA@HIDDEN>
 ("Jorgen \=\?utf-8\?Q\?Sch\=C3\=A4fer\=22's\?\= message of "Thu, 19 Mar 2015
 08:33:52 +0100")
Message-ID: <87bnjpgvje.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 20139
Cc: 20139 <at> debbugs.gnu.org, Stefan Monnier <monnier@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

Jorgen Sch=C3=A4fer <contact@HIDDEN> writes:
> . I.e. the following snippet will message (lambda nil t) and
> then (closure (t) nil t):
>
> (with-temp-buffer
>   (setq lexical-binding t)
>   (insert "(message \"%S\" (lambda () t))")
>   (eval-buffer)
>   (eval-region (point-min) (point-max)))

And this will reverse the behaviour :
(with-temp-buffer
  (insert ";; -*- lexical-binding: t; -*-\n(message \"%S\" (lambda () t))")
  (eval-buffer)
  (eval-region (point-min) (point-max)))

IOW eval-buffer obeys the "file"-local variable by calling
    specbind (Qlexical_binding, lisp_file_lexically_bound_p (buf) ? Qt : Qn=
il);
while eval-region simply uses the current value of lexical-binding.

--=20
Nicolas




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#20139; Package emacs. Full text available.

Message received at 20139 <at> debbugs.gnu.org:


Received: (at 20139) by debbugs.gnu.org; 19 Mar 2015 07:33:57 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Mar 19 03:33:57 2015
Received: from localhost ([127.0.0.1]:52392 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1YYUxo-0003ND-Lu
	for submit <at> debbugs.gnu.org; Thu, 19 Mar 2015 03:33:56 -0400
Received: from loki.jorgenschaefer.de ([87.230.15.51]:36686)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <contact@HIDDEN>) id 1YYUxm-0003N4-LA
 for 20139 <at> debbugs.gnu.org; Thu, 19 Mar 2015 03:33:55 -0400
Received: from mail-we0-f176.google.com (mail-we0-f176.google.com
 [74.125.82.176])
 by loki.jorgenschaefer.de (Postfix) with ESMTPSA id 2DEB0202043
 for <20139 <at> debbugs.gnu.org>; Thu, 19 Mar 2015 08:33:53 +0100 (CET)
Received: by weop45 with SMTP id p45so50189591weo.0
 for <20139 <at> debbugs.gnu.org>; Thu, 19 Mar 2015 00:33:52 -0700 (PDT)
MIME-Version: 1.0
X-Received: by 10.180.79.232 with SMTP id m8mr13849595wix.81.1426750432910;
 Thu, 19 Mar 2015 00:33:52 -0700 (PDT)
Received: by 10.27.83.82 with HTTP; Thu, 19 Mar 2015 00:33:52 -0700 (PDT)
In-Reply-To: <jwvk2yd8z2a.fsf-monnier+emacsbugs@HIDDEN>
References: <87d2466jr3.fsf@HIDDEN>
 <jwvk2yd8z2a.fsf-monnier+emacsbugs@HIDDEN>
Date: Thu, 19 Mar 2015 08:33:52 +0100
Message-ID: <CALqDrScO=xe4bBTmE2YqGfH+PG8bqpmJ_d5iq4G6VwOt_Qp4vA@HIDDEN>
Subject: Re: bug#20139: 25.0.50; eval-buffer ignores lexical-binding
From: =?UTF-8?Q?Jorgen_Sch=C3=A4fer?= <contact@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
Content-Type: text/plain; charset=UTF-8
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 20139
Cc: 20139 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)

On Thu, Mar 19, 2015 at 4:10 AM, Stefan Monnier
<monnier@HIDDEN> wrote:
>> (setq lexical-binding t)
>> (message "%s" (lambda () a))
>
> This is wrong.  The `setq' above is an expression evaluated at run-time,
> whereas what you want to say (that this code is written in the lexical
> version of the Elisp language) is something that needs to be known before
> evaluation proceeds.

I am sorry for the confusion; I added the `setq' form so it is easier
to C-x C-e it. The
bug I describe happens in a buffer with `lexical-binding' set, no
matter which way it
is set. I.e. the following snippet will message (lambda nil t) and
then (closure (t) nil t):

(with-temp-buffer
  (setq lexical-binding t)
  (insert "(message \"%S\" (lambda () t))")
  (eval-buffer)
  (eval-region (point-min) (point-max)))

Regards,
Jorgen




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#20139; Package emacs. Full text available.

Message received at 20139 <at> debbugs.gnu.org:


Received: (at 20139) by debbugs.gnu.org; 19 Mar 2015 03:10:38 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Mar 18 23:10:37 2015
Received: from localhost ([127.0.0.1]:52153 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1YYQqz-0005D3-Np
	for submit <at> debbugs.gnu.org; Wed, 18 Mar 2015 23:10:37 -0400
Received: from pruche.dit.umontreal.ca ([132.204.246.22]:59384)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <monnier@HIDDEN>) id 1YYQqv-0005Cr-QK
 for 20139 <at> debbugs.gnu.org; Wed, 18 Mar 2015 23:10:34 -0400
Received: from pastel.home (lechon.iro.umontreal.ca [132.204.27.242])
 by pruche.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id t2J3AVp3026970;
 Wed, 18 Mar 2015 23:10:31 -0400
Received: by pastel.home (Postfix, from userid 20848)
 id 12D0D96D; Wed, 18 Mar 2015 23:10:31 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: Jorgen Schaefer <contact@HIDDEN>
Subject: Re: bug#20139: 25.0.50; eval-buffer ignores lexical-binding
Message-ID: <jwvk2yd8z2a.fsf-monnier+emacsbugs@HIDDEN>
References: <87d2466jr3.fsf@HIDDEN>
Date: Wed, 18 Mar 2015 23:10:30 -0400
In-Reply-To: <87d2466jr3.fsf@HIDDEN> (Jorgen Schaefer's
 message of "Wed, 18 Mar 2015 23:09:04 +0100")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-NAI-Spam-Flag: NO
X-NAI-Spam-Threshold: 5
X-NAI-Spam-Score: 0
X-NAI-Spam-Rules: 1 Rules triggered
	RV5249=0
X-NAI-Spam-Version: 2.3.0.9393 : core <5249> : inlines <2439> : streams
 <1407821> : uri <1884271>
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: 20139
Cc: 20139 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.3 (-)

> (setq lexical-binding t)
> (message "%s" (lambda () a))

This is wrong.  The `setq' above is an expression evaluated at run-time,
whereas what you want to say (that this code is written in the lexical
version of the Elisp language) is something that needs to be known before
evaluation proceeds.

You can do M-: (setq lexical-binding t) from that buffer in order to
tell Emacs that the code in the buffer uses the lexical
version of the Elisp language, or better, you should put a "-*-
lexical-binding:t -*-" at the top of the file.


        Stefan




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#20139; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 18 Mar 2015 22:09:14 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Mar 18 18:09:14 2015
Received: from localhost ([127.0.0.1]:52047 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1YYM9J-0006J5-Q4
	for submit <at> debbugs.gnu.org; Wed, 18 Mar 2015 18:09:14 -0400
Received: from eggs.gnu.org ([208.118.235.92]:37367)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <contact@HIDDEN>) id 1YYM9I-0006Iy-BH
 for submit <at> debbugs.gnu.org; Wed, 18 Mar 2015 18:09:12 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <contact@HIDDEN>) id 1YYM9H-0007j8-Do
 for submit <at> debbugs.gnu.org; Wed, 18 Mar 2015 18:09:12 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=disabled
 version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:52428)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <contact@HIDDEN>) id 1YYM9H-0007j4-Ab
 for submit <at> debbugs.gnu.org; Wed, 18 Mar 2015 18:09:11 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:39086)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <contact@HIDDEN>) id 1YYM9G-0003fr-E3
 for bug-gnu-emacs@HIDDEN; Wed, 18 Mar 2015 18:09:11 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <contact@HIDDEN>) id 1YYM9D-0007iL-2h
 for bug-gnu-emacs@HIDDEN; Wed, 18 Mar 2015 18:09:10 -0400
Received: from loki.jorgenschaefer.de ([87.230.15.51]:35253)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <contact@HIDDEN>) id 1YYM9C-0007hi-T1
 for bug-gnu-emacs@HIDDEN; Wed, 18 Mar 2015 18:09:07 -0400
Received: by loki.jorgenschaefer.de (Postfix, from userid 1000)
 id 50F93202045; Wed, 18 Mar 2015 23:09:04 +0100 (CET)
From: Jorgen Schaefer <contact@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 25.0.50; eval-buffer ignores lexical-binding
Date: Wed, 18 Mar 2015 23:09:04 +0100
Message-ID: <87d2466jr3.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x
X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address
 (bad octet value).
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -5.0 (-----)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -5.0 (-----)

Given a buffer with these contents:

(setq lexical-binding t)
(message "%s" (lambda () a))

Evaluating both lines with C-x C-e will message (closure (t) nil a), as
it should. But M-x eval-buffer will message (lambda nil a), i.e.
eval-buffer ignores the value of lexical-binding.

I do not think this is the intended behavior :-)

Regards,
Jorgen

In GNU Emacs 25.0.50.1 (x86_64-unknown-linux-gnu)
 of 2015-02-21 on loki.jorgenschaefer.de
Repository revision: 9074a684990600abd9dfad0477c7cd1d2f339ed3
System Description:	Debian GNU/Linux 7.8 (wheezy)

Configured using:
 `configure --without-x'





Acknowledgement sent to Jorgen Schaefer <contact@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#20139; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Thu, 19 Mar 2015 16:00:04 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.