GNU bug report logs - #78304
31.0.50; Support --early-eval on the command line

Previous Next

Package: emacs;

Reported by: Spencer Baugh <sbaugh <at> janestreet.com>

Date: Wed, 7 May 2025 21:35:02 UTC

Severity: normal

Found in version 31.0.50

Full log


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

From: Spencer Baugh <sbaugh <at> janestreet.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 78304 <at> debbugs.gnu.org
Subject: Re: bug#78304: 31.0.50; Support --early-eval on the command line
Date: Tue, 13 May 2025 14:10:24 -0400
Eli Zaretskii <eliz <at> gnu.org> writes:

>> From: Spencer Baugh <sbaugh <at> janestreet.com>
>> Cc: 78304 <at> debbugs.gnu.org
>> Date: Thu, 08 May 2025 12:26:24 -0400
>> 
>> The general use case is configuring things which need to be set in
>> early-init.el while running "emacs -q".
>> 
>> Two concrete use cases I have that are prompting this idea:
>> 
>> - Working with the new load-path-filter-function variable discussed on
>>   emacs-devel.  Since it speeds up all subsequent loads, it needs to be
>>   set at early-init.el time to have maximum effect, but I want to also
>>   be able to use it with emacs -q.
>> 
>> - Context: I'm developing some scripts to run Emacs in a simple
>>   reduced-functionality mode, 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.  For
>>   example, vc-dir is generally useful, so a script to open Emacs running
>>   vc-dir on its own.  (These scripts are similar to things like
>>   https://github.com/maio/smagit and
>>   https://github.com/alphapapa/magit.sh )
>> 
>>   These scripts run with -q, but I need to be able to configure things
>>   about the initial frame, which can only be done with early-init.el.
>> 
>> The workaround that occurs to me is to run emacs without -q, but instead
>> with an --init-directory that contains an early-init.el which does
>> whatever configurations I want, and then at the end does
>> 
>> (setq init-file-user nil
>>       user-emacs-directory (startup--xdg-or-homedot startup--xdg-config-home-emacs nil))
>> 
>> to obtain the same behavior as -q, and also reset user-emacs-directory
>> back to its normal value.  Of course, this is hacky and quite fragile...
>
> Why cannot you do whatever you need in the site-init file?

By that I assume you mean site-start.el, since AFAIK site-init.el is not
loaded at runtime, only at dump time.

As (info "(elisp) Startup Summary") describes, site-start.el is loaded
after package-activate-all is called and the initial frame is set up.
It is therefore loaded too late to configure these things.

(Sorry, accidentally sent my previous reply directly only to Eli)




This bug report was last modified 31 days ago.

Previous Next


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