Subject: bug#66706: [PATCH] Automatic elisp dialect insertion

From: Michael Heerdegen <[email-masked]>
Date: Thu, 26 Oct 2023 02:31:57 +0200

Dmitry Gutov <[email-masked]> writes:

> There will be such users, but their number will likely be lower than
> some might expect, simply because the lexical dialect very much
> resembles how programs are written in other languages these days.

Short version of my reply: Emacs users are a different group than Elisp
package developers.  Let's help them by forcing a lexical binding cookie
in the config file instead of simply making their Emacs potentially not
starting up.

Long version: I guess most new users have not read much of the Emacs
manual before trying Emacs and starting a user config file.  Most of
them will not have started their config file using a lexical-binding:t
cookie.  That means: Most new users started their learning experience of
Elisp using the dynamical dialect.  Since Lisp is not that widespread,
not all Emacs users are programmers, and not all programmers take the
time to care about such a detail as long as the tool works, I would
think that the numbers of users which will see a broken config would be
higher than you expect.  And a lot of them will not know immediately how
to fix it, because this might make not so trivial changes necessary.
Without having their tool at hand.  Not cool.

This would be an unfriendly and annoying thing we would do to some
users.  Especially when Emacs is still perfectly able to interpret the
file.  I really hope we find a different way.

We could temporarily make a cookie mandatory for user config files, and
make Emacs barf at startup if a cookie missing (or ask about what to do:
insert the cookie for you, ask which dialect to use for this time), but
still use dynamical binding at least for a few releases so that Emacs
will still start up, instead of forcing lexical-binding interpretation
on a file that has only ever been interpreted using dynamical binding in
the past.

Michael.