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

From: Stefan Kangas <[email-masked]>
Date: Tue, 18 Feb 2025 13:59:13 -0500

Visuwesh <[email-masked]> writes:

> [புதன் பிப்ரவரி 19, 2025] Phil Sainty wrote:
>
>> dancol wrote:
>>> It's been many years now. Everyone has had enough time to adapt to
>>> lexical-binding.
>>
>> I'm sure a majority of elisp programmers are aware of lexical-binding
>> by this point, and (in a great many cases) have adapted to it; but,
>> with the exception of those who are following current developments,
>> nobody has had ANY time to adapt to the idea that lexical-binding is
>> the DEFAULT.  Users having time to adapt to THAT begins with the first
>> release that warns that it's going to happen, and we haven't had one
>> of those yet.
>>
>> Even the users who understand Emacs Lisp should have advance warning
>> of such a change so that they can make the necessary changes in
>> advance of that change coming into effect.
>>
>> Emacs is not only used by elisp programmers, though.  Many users don't
>> understand elisp; will not understand dynamic-vs-lexical binding; and
>> will not know why the libraries they have been using for many years
>> suddenly don't work properly.
>>
>> Those users should be informed that they need to change something
>> before it has a chance to break things, so this should be sign-posted
>> for a long time in advance of the actual change, so that users really
>> do have time to adapt.
>
> +1.  It is also a bit time consuming to change code to follow lexical
> binding and AFAIU from reading the list, there is no straightforward way
> to do so.

This change is unlikely to be very disruptive at this point.  For
starters, users can easily just add this to any ELisp file that lacks it
and move on with their lives:

    -*- lexical-binding:nil -*-

This is a trivial exercise for an Emacs user of almost any skill level.
We could consider providing Emacs commands and/or awk scripts to make
this even easier, but I'm not convinced that we even need that.  It
can't hurt, I suppose.

What's more, and this is from my personal experience of converting
hundreds of .el files (see git log), most files will usually run just
fine under lexbind, without any changes.  I expect that user init files
will typically fall into this category.