Subject: bug#78304: 31.0.50; Support --early-eval on the command line

From: Lynn Winebarger <[email-masked]>
Date: Fri, 16 May 2025 11:14:49 -0400

On Fri, May 16, 2025 at 3:11 AM Eli Zaretskii <[email-masked]> wrote:
>
> Actually, I think everything Spencer wants to do is achievable via
> site-start file, and it's the unnecessary urge to use -q that creates
> the problem he tries to solve.  I don't think anything like customized
> dumping is needed to solve this problem.

I'm just taking Spencer's problem description at face-value.
One of Spencer's use cases (the primary one, I thought) is to create
"a script" that will run a "reduced-functionality" mode, particularly:
>>>   [...] which provide access to just one buffer
>>>   running in a specific major mode, with the goal of making Emacs
>>>  features accessible to users who don't currently use Emacs.

The standard emacs startup is designed to ensure users can override
site defaults without too much effort.  From (elisp)Building Emacs:

>>    It is not advisable to put anything in ‘site-load.el’ or
>> ‘site-init.el’ that would alter any of the features that users expect in
>> an ordinary unmodified Emacs.  If you feel you must override normal
>> features for your site, do it with ‘default.el’, so that users can
>> override your changes if they wish.  [...]

What Spencer is describing is a use-case where users get a custom
presentation of emacs that would indeed "alter any of the features
that users expect in an ordinary unmodified Emacs".  That's why he
wants to use "-q", because the customizations of an ordinary emacs
session are not suited to the purpose of the particular presentation.
The most (probably only) foolproof way of doing that is writing a
custom startup and maybe even the top-level, depending on just how
reduced the functionality is supposed to be.  That approach also has
the advantage of working with many versions of Emacs packages in
versions of Linux distros that haven't hit EOL (i.e. >= 25 or so,
whenever the portable dumper became standard) .  As you mentioned in
another response to this bug, the standard startup process has changed
over those releases, but most of it (except the really low-level bits)
are done in lisp, so those parts can be simplified or changed
arbitrarily to suit the use.  Of course, the wrapper script will have
to intercept any arguments that would be processed by the C runtime
startup, such as "-h","-temacs", etc

Lynn