emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master e9c189c: Fix initialization of custom-delayed-init-


From: Eli Zaretskii
Subject: [Emacs-diffs] master e9c189c: Fix initialization of custom-delayed-init-variables
Date: Tue, 12 Jun 2018 11:05:16 -0400 (EDT)

branch: master
commit e9c189ccae342c63de2629c5a51d1f40d1a562b6
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>

    Fix initialization of custom-delayed-init-variables
    
    * lisp/startup.el (command-line): Re-evaluate delayed-init custom
    variables one more time after setting up the initial
    window-system.  (Bug#30994)
    
    * doc/emacs/custom.texi (Early Init File):
    * etc/NEWS: Warn against using early-init.el as a substitute for
    .emacs.
---
 doc/emacs/custom.texi | 12 +++++++++++-
 etc/NEWS              |  7 +++++++
 lisp/startup.el       | 13 ++++++++++---
 3 files changed, 28 insertions(+), 4 deletions(-)

diff --git a/doc/emacs/custom.texi b/doc/emacs/custom.texi
index dbcc4c1..51e36ea 100644
--- a/doc/emacs/custom.texi
+++ b/doc/emacs/custom.texi
@@ -2606,7 +2606,7 @@ Type @kbd{C-q}, followed by the key you want to bind, to 
insert @var{char}.
 @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
@@ -2619,5 +2619,15 @@ 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.  @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
address@hidden  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
address@hidden  @xref{Hooks}.
+
   For more information on the early init file, @pxref{Init File,,,
 elisp, The Emacs Lisp Reference Manual}.
diff --git a/etc/NEWS b/etc/NEWS
index 402dcb1..52cedc4 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -58,6 +58,13 @@ is initialized.  The primary purpose is to allow customizing 
how the
 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
diff --git a/lisp/startup.el b/lisp/startup.el
index 245b9ac..fdf6cc1 100644
--- a/lisp/startup.el
+++ b/lisp/startup.el
@@ -1126,11 +1126,11 @@ please check its value")
   ;; 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
@@ -1262,6 +1262,13 @@ please check its value")
     (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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]