GNU bug report logs - #74145
31.0.50; Default lexical-binding to t

Previous Next

Package: emacs;

Reported by: Stefan Monnier <monnier <at> iro.umontreal.ca>

Date: Thu, 31 Oct 2024 20:59:02 UTC

Severity: wishlist

Tags: patch

Found in version 31.0.50

Full log


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

From: Eli Zaretskii <eliz <at> gnu.org>
To: rms <at> gnu.org
Cc: 74145 <at> debbugs.gnu.org, monnier <at> iro.umontreal.ca
Subject: Re: bug#74145: 31.0.50; Default lexical-binding to t
Date: Fri, 14 Mar 2025 10:31:38 +0200
> Cc: 74145 <at> debbugs.gnu.org
> From: Richard Stallman <rms <at> gnu.org>
> Date: Thu, 13 Mar 2025 23:51:45 -0400
> 
>   > >   > E.g. "why don't we start by warning when we load files
>   > >   > without the lexical-binding cookie?":
>   > >
>   > >   >     https://lists.gnu.org/r/emacs-devel/2024-05/msg00250.html
>   > >
>   > >   > I don't have any new answers to those questions.
>   > >
>   > > Are you ok with our implementing that warning now?
> 
>   > Of course.  For me, the purpose of this bug#74145 is not to see *if* we
>   > can change the default but *how*, or rather under which conditions.
> 
> This chamge woud be good to make right away.  Please go ahead.
> 
> However, to change the default value of `lexical-binding' would 
> cause cnfusion and problems.  Please don't do that now.
> 
> Instead, we should do the other change that reminds users
> to make their files set this variable.  We could release 30.2
> right away with that one change.  Then users would start changing
> their files to avoid future problems.

We generally avoid making changes that aren't bugfixes in bugfix
releases such as 30.2.  But we could make an exception in this case, I
guess.

> I have an idea for another change that will help with this too.
> The idea is, whenever Emacs loads a file from a directory D,
> it should look for other Emacs Lisp files in D which lack a binding
> for lexical-binding, and if it sees any, it should
> urge the user to add such bindings to all the Lisp files in D.
> 
> To make this easier for users, it could ask the qyestion,
> 
>   Add a lexical-binding spec to each Emacs Lisp file in dir D?
> 
> If the user says yes, it could ask
> 
>   Use lexical-binding t for all files, or lexical-binding nil for all,
>   or ask about each file?
> 
> This will encourage users to fix lots of files soon, even files
> they won't actually have thought about.

But it could slow down loading files, especially if D is a large
directory.  We should also allow the user to opt out from these
questions and the check itself.

On balance, I'm not sure this feature will not be a nuisance more than
help.  In any case, I think we should discuss this kind of change on
emacs-devel, not here.





This bug report was last modified 68 days ago.

Previous Next


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