49.4.6 The Early Init File
Most customizations for Emacs should be put in the normal init file.
See The Emacs Initialization File. However, it is sometimes necessary
to have customizations take effect during Emacs startup earlier than the
normal init file is processed. Such customizations can be put in the early
init file, ~/.config/emacs/early-init.el
or ~/.emacs.d/early-init.el
. This file is loaded before the
package system and GUI is initialized, so in it you can customize variables
that affect the package initialization process,
such as package-enable-at-startup
, package-load-list
, and
package-user-dir
. Note that variables like package-archives
which only affect the installation of new packages, and not the process of
making already-installed packages available, may be customized in the regular
init file. See Package Installation.
We do not recommend that you move into early-init.el
customizations that can be left in the normal init files. That is
because the early init file is read before the GUI is initialized, so
customizations related to GUI features will not work reliably in
early-init.el
. By contrast, the normal init files are read
after the GUI is initialized. If you must have customizations in the
early init file that rely on GUI features, make them run off hooks
provided by the Emacs startup, such as window-setup-hook
or
tty-setup-hook
. See Hooks.
For more information on the early init file, see Init File in The Emacs Lisp Reference Manual.