@subsection The Early Init File
@cindex early init file
- Most customizations for Emacs can be put in the normal init file,
+ Most customizations for Emacs should be put in the normal init file,
@file{.emacs} or @file{~/.emacs.d/init.el}. However, it is sometimes desirable
to have customizations that take effect during Emacs startup earlier than the
normal init file is processed. Such customizations can be put in the early
making already-installed packages available, may be customized in the regular
init file. @xref{Package Installation}.
+ We do not recommend that you move into @file{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
+@file{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 @code{window-setup-hook} or
+@code{tty-setup-hook}. @xref{Hooks}.
+
For more information on the early init file, @pxref{Init File,,,
elisp, The Emacs Lisp Reference Manual}.
package system is initialized given that initialization now happens
before loading the regular init file (see below).
+We recommend against putting any customizations in this file that
+don't need to be set up before initializing installed add-on packages,
+because the early init file is read too early into the startup
+process, and some important parts of the Emacs session, such as
+window-system and other GUI features, are not yet set up, which could
+make some customization fail to work.
+
+++
** Installed packages are now activated *before* loading the init file.
This is part of a change intended to eliminate the behavior of
;; Re-evaluate predefined variables whose initial value depends on
;; the runtime context.
(let (current-load-list) ; c-r-s may call defvar, and hence LOADHIST_ATTACH
- (mapc 'custom-reevaluate-setting
+ (setq custom-delayed-init-variables
;; Initialize them in the same order they were loaded, in case there
;; are dependencies between them.
- (prog1 (nreverse custom-delayed-init-variables)
- (setq custom-delayed-init-variables nil))))
+ (nreverse custom-delayed-init-variables))
+ (mapc 'custom-reevaluate-setting custom-delayed-init-variables))
;; Warn for invalid user name.
(when init-file-user
(startup--setup-quote-display)
(setq internal--text-quoting-flag t))
+ ;; Re-evaluate again the predefined variables whose initial value
+ ;; depends on the runtime context, in case some of them depend on
+ ;; the window-system features. Example: blink-cursor-mode.
+ (let (current-load-list) ; c-r-s may call defvar, and hence LOADHIST_ATTACH
+ (mapc 'custom-reevaluate-setting custom-delayed-init-variables)
+ (setq custom-delayed-init-variables nil))
+
(normal-erase-is-backspace-setup-frame)
;; Register default TTY colors for the case the terminal hasn't a