Subject: bug#75022: 31.0.50; --init-directory sets user-emacs-directory after user eln-cache is set

From: Eli Zaretskii <[email-masked]>
Date: Sun, 22 Dec 2024 14:44:58 +0200

> Date: Sun, 22 Dec 2024 03:57:01 -0800
> From: "Jordan Isaacs" <[email-masked]>
> 
> In startup.el, the user-emacs-directory and the user eln-cache are set up before processing command line args.
> The user eln-cache is then gets updated after the early-init.el is loaded. This leaves a gap where early-init.el is
> loaded without the correct eln-cache directory. This means there will always be a cache miss if the early-init.eln
> file was in the `--init-directory`.
> 
> To fix this, either `--init-directory` needs to be read before setting up the user eln-cache, or a call to `startup--update-eln-cache` needs to be called after command line args are processed since user-emacs-directory may have changed (from `--init-directory`).

You are not supposed to have in early-init.el stuff that needs to be
natively-compiled.  early-init.el is for changing the few variables
which affect the initialization stage, and that doesn't need native
code.  You are supposed to have most of your configuration in the
normal init file, not in early-init.el.

As for the --init-directory, it doesn't affect the search for your
init files, it only affects the value of user-emacs-directory (for
looking up other files).

So I don't think I understand why you are asking for changes in how
the startup code works in Emacs.  Please tell more about your use
case.