GNU bug report logs - #20640
24.5; lexical-binding should work like a normal file-local variable

Previous Next

Package: emacs;

Reported by: Philipp Stephani <p.stephani2 <at> gmail.com>

Date: Sun, 24 May 2015 10:21:03 UTC

Severity: wishlist

Tags: wontfix

Merged with 10605, 15849

Found in versions 24.3.50, 24.5

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 20640 in the body.
You can then email your comments to 20640 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#20640; Package emacs. (Sun, 24 May 2015 10:21:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Philipp Stephani <p.stephani2 <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 24 May 2015 10:21:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Philipp Stephani <p.stephani2 <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.5; lexical-binding should work like a normal file-local variable
Date: Sun, 24 May 2015 12:19:34 +0200
The manual
(https://www.gnu.org/software/emacs/manual/html_node/elisp/Using-Lexical-Binding.html)
says about `lexical-binding':

   Note that unlike other such variables, this one must be set in the
   first line of a file.

I think the only reason for this is an implementation detail
(lexical-binding is parsed by other code than the other file-local
variables).  It would be great to make it consistent with other
variables so that the user doesn't need to care about the difference.



In GNU Emacs 24.5.1 (x86_64-apple-darwin14.1.0, NS apple-appkit-1344.72)
 of 2015-04-12 on p
Configured using:
 `configure --prefix=/usr/local/Cellar/emacs/24.5
 --enable-locallisppath=/usr/local/share/emacs/site-lisp
 --infodir=/usr/local/Cellar/emacs/24.5/share/info/emacs
 --with-file-notification=gfile --with-dbus --with-gnutls --with-rsvg
 --with-imagemagick --without-popmail --with-ns
 --disable-ns-self-contained'

Important settings:
  value of $LANG: de_DE.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Emacs-Lisp

Minor modes in effect:
  tooltip-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
(New file)
For this change to take effect revisit file using s-u
Saving file /tmp/foo.el...
Wrote /tmp/foo.el
C-x C-g is undefined
You can run the command `revert-buffer' with s-u

Load-path shadows:
None found.

Features:
(shadow sort gnus-util mail-extr emacsbug message format-spec rfc822 mml
easymenu mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums
mm-util mail-prsvr mail-utils warnings help-fns files-x xterm time-date
tooltip electric uniquify ediff-hook vc-hooks lisp-float-type mwheel
ns-win tool-bar dnd fontset image regexp-opt fringe tabulated-list
newcomment lisp-mode prog-mode register page menu-bar rfn-eshadow timer
select scroll-bar mouse jit-lock font-lock syntax facemenu font-core
frame cham georgian utf-8-lang misc-lang vietnamese tibetan thai
tai-viet lao korean japanese hebrew greek romanian slovak czech european
ethiopic indian cyrillic chinese case-table epa-hook jka-cmpr-hook help
simple abbrev minibuffer nadvice loaddefs button faces cus-face macroexp
files text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote make-network-process
dbusbind gfilenotify cocoa ns multi-tty emacs)

Memory information:
((conses 16 79278 6322)
 (symbols 48 17661 0)
 (miscs 40 38 142)
 (strings 32 10374 4568)
 (string-bytes 1 270725)
 (vectors 16 7214)
 (vector-slots 8 341033 28254)
 (floats 8 62 328)
 (intervals 56 188 27)
 (buffers 960 14))




Forcibly Merged 10605 15849 20640. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Sun, 24 May 2015 23:20:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#20640; Package emacs. (Mon, 25 May 2015 02:01:03 GMT) Full text and rfc822 format available.

Message #10 received at 20640 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Philipp Stephani <p.stephani2 <at> gmail.com>
Cc: 20640 <at> debbugs.gnu.org
Subject: Re: bug#20640: 24.5;
 lexical-binding should work like a normal file-local variable
Date: Sun, 24 May 2015 21:59:45 -0400
> I think the only reason for this is an implementation detail
> (lexical-binding is parsed by other code than the other file-local
> variables).  It would be great to make it consistent with other
> variables so that the user doesn't need to care about the difference.

Allowing it at the end of the file, would require jumping to the end of
the file first, and then starting over from the beginning.
That'd be a very bad requirement.


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#20640; Package emacs. (Mon, 25 May 2015 20:34:02 GMT) Full text and rfc822 format available.

Message #13 received at 20640 <at> debbugs.gnu.org (full text, mbox):

From: Daniel Colascione <dancol <at> dancol.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>, 
 Philipp Stephani <p.stephani2 <at> gmail.com>
Cc: 20640 <at> debbugs.gnu.org
Subject: Re: bug#20640: 24.5;
 lexical-binding should work like a normal file-local variable
Date: Mon, 25 May 2015 13:33:05 -0700
[Message part 1 (text/plain, inline)]
On 05/24/2015 06:59 PM, Stefan Monnier wrote:
>> I think the only reason for this is an implementation detail
>> (lexical-binding is parsed by other code than the other file-local
>> variables).  It would be great to make it consistent with other
>> variables so that the user doesn't need to care about the difference.
> 
> Allowing it at the end of the file, would require jumping to the end of
> the file first, and then starting over from the beginning.
> That'd be a very bad requirement.

Why? We're going to have to read that page eventually anyway.

[signature.asc (application/pgp-signature, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#20640; Package emacs. (Mon, 25 May 2015 22:56:03 GMT) Full text and rfc822 format available.

Message #16 received at 20640 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Daniel Colascione <dancol <at> dancol.org>
Cc: Philipp Stephani <p.stephani2 <at> gmail.com>, 20640 <at> debbugs.gnu.org
Subject: Re: bug#20640: 24.5;
 lexical-binding should work like a normal file-local variable
Date: Mon, 25 May 2015 18:55:50 -0400
>>> I think the only reason for this is an implementation detail
>>> (lexical-binding is parsed by other code than the other file-local
>>> variables).  It would be great to make it consistent with other
>>> variables so that the user doesn't need to care about the difference.
>> Allowing it at the end of the file, would require jumping to the end of
>> the file first, and then starting over from the beginning.
>> That'd be a very bad requirement.
> Why? We're going to have to read that page eventually anyway.

Because we can't read the first page correctly until we know whether it
should be read in lexical-binding mode or in dynamic-binding mode.


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#20640; Package emacs. (Tue, 26 May 2015 01:07:02 GMT) Full text and rfc822 format available.

Message #19 received at 20640 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: Philipp Stephani <p.stephani2 <at> gmail.com>,
 Daniel Colascione <dancol <at> dancol.org>, 20640 <at> debbugs.gnu.org
Subject: Re: bug#20640: 24.5;
 lexical-binding should work like a normal file-local variable
Date: Mon, 25 May 2015 21:06:47 -0400
Stefan Monnier wrote:

>>> Allowing it at the end of the file, would require jumping to the end of
>>> the file first, and then starting over from the beginning.
>>> That'd be a very bad requirement.
>> Why? We're going to have to read that page eventually anyway.
>
> Because we can't read the first page correctly until we know whether it
> should be read in lexical-binding mode or in dynamic-binding mode.

A few years ago, we said (IIUC) it was desirable:

http://debbugs.gnu.org/10605
http://lists.gnu.org/archive/html/emacs-devel/2012-01/msg00543.html

Or have speed-ups in uncompiled code shifted the balance?

(But no-one shows any sign of doing anything, so it's all academic.)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#20640; Package emacs. (Tue, 26 May 2015 17:14:02 GMT) Full text and rfc822 format available.

Message #22 received at 20640 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Glenn Morris <rgm <at> gnu.org>
Cc: Philipp Stephani <p.stephani2 <at> gmail.com>,
 Daniel Colascione <dancol <at> dancol.org>, 20640 <at> debbugs.gnu.org
Subject: Re: bug#20640: 24.5;
 lexical-binding should work like a normal file-local variable
Date: Tue, 26 May 2015 13:12:31 -0400
> A few years ago, we said (IIUC) it was desirable:
> http://debbugs.gnu.org/10605

Well, *you* said, but *we* didn't, IIUC.

For me, as long as we intend to allow running .el files without
byte-compiling them, I think allowing lexical-binding to be specified at
the end of the file would be a design mistake.


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#20640; Package emacs. (Tue, 26 May 2015 20:54:02 GMT) Full text and rfc822 format available.

Message #25 received at 20640 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: Philipp Stephani <p.stephani2 <at> gmail.com>,
 Daniel Colascione <dancol <at> dancol.org>, 20640 <at> debbugs.gnu.org
Subject: Re: bug#20640: 24.5;
 lexical-binding should work like a normal file-local variable
Date: Tue, 26 May 2015 16:53:08 -0400
Stefan Monnier wrote:

>> A few years ago, we said (IIUC) it was desirable:
>> http://debbugs.gnu.org/10605
>
> Well, *you* said, but *we* didn't, IIUC.

Hah, true enough, although IMO you were a least a little more ambiguous in

>> http://lists.gnu.org/archive/html/emacs-devel/2012-01/msg00543.html


Anyway:

> For me, as long as we intend to allow running .el files without
> byte-compiling them, I think allowing lexical-binding to be specified at
> the end of the file would be a design mistake.

Even if the code were to check for "coding:" (which we already have to
scan the end of the file for) and "lexical-binding:" in the same pass?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#20640; Package emacs. (Wed, 27 May 2015 01:50:06 GMT) Full text and rfc822 format available.

Message #28 received at 20640 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Glenn Morris <rgm <at> gnu.org>
Cc: Philipp Stephani <p.stephani2 <at> gmail.com>,
 Daniel Colascione <dancol <at> dancol.org>, 20640 <at> debbugs.gnu.org
Subject: Re: bug#20640: 24.5;
 lexical-binding should work like a normal file-local variable
Date: Tue, 26 May 2015 21:49:35 -0400
> Even if the code were to check for "coding:" (which we already have to
> scan the end of the file for) and "lexical-binding:" in the same pass?

The check for "coding:" is a misdesign, indeed.  I think we should use
some utf-8 tell-tale sign at the beginning of *.el files to eliminate
the need to check for "coding:" (and to go through
load-with-code-conversion) in the normal case.  It could be a utf-8 BOM
or something like that.  Ideally we could give extra meaning to this
marker so it not only means "uses utf-8" but also "uses
lexical-scoping", so that we can have a future where we don't need to
add "lexical-binding:t" to every file.


        Stefan




Severity set to 'wishlist' from 'minor' Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Wed, 27 May 2015 03:23:03 GMT) Full text and rfc822 format available.

Added tag(s) wontfix. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Wed, 27 May 2015 03:23:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#20640; Package emacs. (Sun, 21 Jun 2015 20:10:03 GMT) Full text and rfc822 format available.

Message #35 received at 20640 <at> debbugs.gnu.org (full text, mbox):

From: Philipp Stephani <p.stephani2 <at> gmail.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>, Glenn Morris <rgm <at> gnu.org>
Cc: Daniel Colascione <dancol <at> dancol.org>, 20640 <at> debbugs.gnu.org
Subject: Re: bug#20640: 24.5; lexical-binding should work like a normal
 file-local variable
Date: Sun, 21 Jun 2015 20:08:52 +0000
[Message part 1 (text/plain, inline)]
Stefan Monnier <monnier <at> iro.umontreal.ca> schrieb am Mi., 27. Mai 2015 um
03:49 Uhr:

> > Even if the code were to check for "coding:" (which we already have to
> > scan the end of the file for) and "lexical-binding:" in the same pass?
>
> The check for "coding:" is a misdesign, indeed.  I think we should use
> some utf-8 tell-tale sign at the beginning of *.el files to eliminate
> the need to check for "coding:" (and to go through
> load-with-code-conversion) in the normal case.  It could be a utf-8 BOM
> or something like that.  Ideally we could give extra meaning to this
> marker so it not only means "uses utf-8" but also "uses
> lexical-scoping", so that we can have a future where we don't need to
> add "lexical-binding:t" to every file.
>
>
>
I don't think this is a misdesign. In most cases files are either seekable
or small enough so that reading the variables from the end is tolerable. I
prefer the end of files for local variables because they tend to be less
important than the actual content.
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#20640; Package emacs. (Mon, 22 Jun 2015 15:58:02 GMT) Full text and rfc822 format available.

Message #38 received at 20640 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Philipp Stephani <p.stephani2 <at> gmail.com>
Cc: Glenn Morris <rgm <at> gnu.org>, Daniel Colascione <dancol <at> dancol.org>,
 20640 <at> debbugs.gnu.org
Subject: Re: bug#20640: 24.5;
 lexical-binding should work like a normal file-local variable
Date: Mon, 22 Jun 2015 11:56:46 -0400
> I don't think this is a misdesign. In most cases files are either seekable
> or small enough so that reading the variables from the end is tolerable. I
> prefer the end of files for local variables because they tend to be less
> important than the actual content.

I'm not talking about file-local variables in general.  I'm talking
about the "coding:" pseudo-variable.


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#20640; Package emacs. (Sun, 11 Sep 2016 18:05:02 GMT) Full text and rfc822 format available.

Message #41 received at 20640 <at> debbugs.gnu.org (full text, mbox):

From: Philipp Stephani <p.stephani2 <at> gmail.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: Glenn Morris <rgm <at> gnu.org>, Daniel Colascione <dancol <at> dancol.org>,
 20640 <at> debbugs.gnu.org
Subject: Re: bug#20640: 24.5; lexical-binding should work like a normal
 file-local variable
Date: Sun, 11 Sep 2016 18:04:13 +0000
[Message part 1 (text/plain, inline)]
Stefan Monnier <monnier <at> iro.umontreal.ca> schrieb am Mo., 22. Juni 2015 um
17:57 Uhr:

> > I don't think this is a misdesign. In most cases files are either
> seekable
> > or small enough so that reading the variables from the end is tolerable.
> I
> > prefer the end of files for local variables because they tend to be less
> > important than the actual content.
>
> I'm not talking about file-local variables in general.  I'm talking
> about the "coding:" pseudo-variable.
>
>
>
No matter how we choose to call it: My argument stands, reading such
pseudo-variables from the end of the file is desirable, useful, and has
negligible disadvantages. Or do we have evidence that users routinely read
very large (gigabyte-sized) Elisp files from non-seekable sources?
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#20640; Package emacs. (Sun, 11 Sep 2016 19:27:01 GMT) Full text and rfc822 format available.

Message #44 received at 20640 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Philipp Stephani <p.stephani2 <at> gmail.com>
Cc: monnier <at> iro.umontreal.ca, 20640 <at> debbugs.gnu.org
Subject: Re: bug#20640: 24.5;
 lexical-binding should work like a normal file-local variable
Date: Sun, 11 Sep 2016 22:25:54 +0300
> From: Philipp Stephani <p.stephani2 <at> gmail.com>
> Date: Sun, 11 Sep 2016 18:04:13 +0000
> Cc: 20640 <at> debbugs.gnu.org
> 
> Stefan Monnier <monnier <at> iro.umontreal.ca> schrieb am Mo., 22. Juni 2015 um 17:57 Uhr:
> 
>  > I don't think this is a misdesign. In most cases files are either seekable
>  > or small enough so that reading the variables from the end is tolerable. I
>  > prefer the end of files for local variables because they tend to be less
>  > important than the actual content.
> 
>  I'm not talking about file-local variables in general. I'm talking
>  about the "coding:" pseudo-variable.
> 
> No matter how we choose to call it: My argument stands, reading such pseudo-variables from the end of the
> file is desirable, useful, and has negligible disadvantages. Or do we have evidence that users routinely read
> very large (gigabyte-sized) Elisp files from non-seekable sources? 

Guys, is this really such a big deal to justify changes in an area
which was not touched in eons?  Just let the sleeping dogs lie.





bug closed, send any further explanations to 10605 <at> debbugs.gnu.org and Glenn Morris <rgm <at> gnu.org> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Fri, 23 Aug 2019 05:32:02 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. (Fri, 20 Sep 2019 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 210 days ago.

Previous Next


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