Subject: bug#74145: 31.0.50; Default lexical-binding to t

From: Richard Stallman <[email-masked]>
Date: Thu, 13 Mar 2025 23:51:45 -0400

[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

  > >   > 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.

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.

This change could be extended in various ways.
For instance, it could record where there are files that lack
a spec for `lexical-binding', and ask about 20 files per day.

-- 
Dr Richard Stallman (https://stallman.org)
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)