aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRadon Rosborough2018-03-02 21:06:53 -0800
committerEli Zaretskii2018-03-19 10:44:40 +0200
commit2db57579b08ac99c464b6d3698648b3167fc5d55 (patch)
treed13a814f944a13cfea43c25e7310befc800f342f
parent667cdf421ff64b1fe736f75e8a7f8864de1b5026 (diff)
downloademacs-2db57579b08ac99c464b6d3698648b3167fc5d55.tar.gz
emacs-2db57579b08ac99c464b6d3698648b3167fc5d55.zip
Various follow-ups for early init file changes
* doc/emacs/custom.texi (Early Init File): Add more details about which variables must be set in the early init file rather than the regular init file. See https://lists.nongnu.org/archive/html/bug-gnu-emacs/2018-02/msg00827.html * lisp/emacs-lisp/package.el (package-enable-at-startup): Update docstring to note that packages are now made available before loading the init file, rather than afterwards. See https://lists.gnu.org/archive/html/emacs-devel/2018-02/msg00632.html (package-load-list): Refer to "making available" rather than "loading" for packages. See https://lists.gnu.org/archive/html/emacs-devel/2018-02/msg00298.html * lisp/startup.el (command-line): Call `custom-reevaluate-setting' on predefined variables before loading the early init file and before `package-initialize' is called. This prevents `Info-default-directory-list' from being unbound when `package-initialize' tries to access it during startup. See https://lists.gnu.org/archive/html/emacs-devel/2018-02/msg00545.html * lisp/emacs-lisp/package.el (package-initialize): Issue a warning if called twice. See: https://lists.gnu.org/archive/html/emacs-devel/2018-02/msg00626.html https://lists.gnu.org/archive/html/emacs-devel/2018-03/msg00301.html
-rw-r--r--doc/emacs/custom.texi10
-rw-r--r--lisp/emacs-lisp/package.el40
-rw-r--r--lisp/startup.el18
3 files changed, 44 insertions, 24 deletions
diff --git a/doc/emacs/custom.texi b/doc/emacs/custom.texi
index be73d7a289a..a69888cdbd6 100644
--- a/doc/emacs/custom.texi
+++ b/doc/emacs/custom.texi
@@ -2607,9 +2607,13 @@ desirable to have customizations that take effect during Emacs startup
2607earlier than the normal init file is processed. Such customizations 2607earlier than the normal init file is processed. Such customizations
2608can be put in the early init file, @file{~/.emacs.d/early-init.el}. 2608can be put in the early init file, @file{~/.emacs.d/early-init.el}.
2609This file is loaded before the package system is initialized, so in it 2609This file is loaded before the package system is initialized, so in it
2610you can customize variables that affect the initialization process, 2610you can customize variables that affect the package initialization
2611such as @code{package-enable-at-startup} and @code{package-load-list}. 2611process, such as @code{package-enable-at-startup},
2612@xref{Package Installation}. 2612@code{package-load-list}, and @code{package-user-dir}. Note that
2613variables like @code{package-archives} which only affect the
2614installation of new packages, and not the process of making
2615already-installed packages available, may be customized in the regular
2616init file. @xref{Package Installation}.
2613 2617
2614 For more information on the early init file, @pxref{Init File,,, 2618 For more information on the early init file, @pxref{Init File,,,
2615elisp, The Emacs Lisp Reference Manual}. 2619elisp, The Emacs Lisp Reference Manual}.
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index 999e0d07524..1edc06d024d 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -161,29 +161,34 @@
161;;; Customization options 161;;; Customization options
162;;;###autoload 162;;;###autoload
163(defcustom package-enable-at-startup t 163(defcustom package-enable-at-startup t
164 "Whether to activate installed packages when Emacs starts. 164 "Whether to make installed packages available when Emacs starts.
165If non-nil, packages are activated after reading the init file 165If non-nil, packages are made available before reading the init
166and before `after-init-hook'. Activation is not done if 166file (but after reading the early init file). This means that if
167`user-init-file' is nil (e.g. Emacs was started with \"-q\"). 167you wish to set this variable, you must do so in the early init
168file. Regardless of the value of this variable, packages are not
169made available if `user-init-file' is nil (e.g. Emacs was started
170with \"-q\").
168 171
169Even if the value is nil, you can type \\[package-initialize] to 172Even if the value is nil, you can type \\[package-initialize] to
170activate the package system at any time." 173make installed packages available at any time, or you can
174call (package-initialize) in your init-file."
171 :type 'boolean 175 :type 'boolean
172 :version "24.1") 176 :version "24.1")
173 177
174(defcustom package-load-list '(all) 178(defcustom package-load-list '(all)
175 "List of packages for `package-initialize' to load. 179 "List of packages for `package-initialize' to make available.
176Each element in this list should be a list (NAME VERSION), or the 180Each element in this list should be a list (NAME VERSION), or the
177symbol `all'. The symbol `all' says to load the latest installed 181symbol `all'. The symbol `all' says to make available the latest
178versions of all packages not specified by other elements. 182installed versions of all packages not specified by other
183elements.
179 184
180For an element (NAME VERSION), NAME is a package name (a symbol). 185For an element (NAME VERSION), NAME is a package name (a symbol).
181VERSION should be t, a string, or nil. 186VERSION should be t, a string, or nil.
182If VERSION is t, the most recent version is activated. 187If VERSION is t, the most recent version is made available.
183If VERSION is a string, only that version is ever loaded. 188If VERSION is a string, only that version is ever made available.
184 Any other version, even if newer, is silently ignored. 189 Any other version, even if newer, is silently ignored.
185 Hence, the package is \"held\" at that version. 190 Hence, the package is \"held\" at that version.
186If VERSION is nil, the package is not loaded (it is \"disabled\")." 191If VERSION is nil, the package is not made available (it is \"disabled\")."
187 :type '(repeat (choice (const all) 192 :type '(repeat (choice (const all)
188 (list :tag "Specific package" 193 (list :tag "Specific package"
189 (symbol :tag "Package name") 194 (symbol :tag "Package name")
@@ -1439,10 +1444,21 @@ If optional arg NO-ACTIVATE is non-nil, don't activate packages.
1439If called as part of loading `user-init-file', set 1444If called as part of loading `user-init-file', set
1440`package-enable-at-startup' to nil, to prevent accidentally 1445`package-enable-at-startup' to nil, to prevent accidentally
1441loading packages twice. 1446loading packages twice.
1447
1442It is not necessary to adjust `load-path' or `require' the 1448It is not necessary to adjust `load-path' or `require' the
1443individual packages after calling `package-initialize' -- this is 1449individual packages after calling `package-initialize' -- this is
1444taken care of by `package-initialize'." 1450taken care of by `package-initialize'.
1451
1452If `package-initialize' is called twice during Emacs startup,
1453signal a warning, since this is a bad idea except in highly
1454advanced use cases. To suppress the warning, remove the
1455superfluous call to `package-initialize' from your init-file. If
1456you have code which must run before `package-initialize', put
1457that code in the early init-file."
1445 (interactive) 1458 (interactive)
1459 (when (and package--initialized (not after-init-time))
1460 (lwarn '(package reinitialization) :warning
1461 "Unnecessary call to `package-initialize' in init file"))
1446 (setq package-alist nil) 1462 (setq package-alist nil)
1447 (setq package-enable-at-startup nil) 1463 (setq package-enable-at-startup nil)
1448 (package-load-all-descriptors) 1464 (package-load-all-descriptors)
diff --git a/lisp/startup.el b/lisp/startup.el
index 4105c1db2d6..2669342edae 100644
--- a/lisp/startup.el
+++ b/lisp/startup.el
@@ -1115,6 +1115,15 @@ please check its value")
1115 (and command-line-args 1115 (and command-line-args
1116 (setcdr command-line-args args))) 1116 (setcdr command-line-args args)))
1117 1117
1118 ;; Re-evaluate predefined variables whose initial value depends on
1119 ;; the runtime context.
1120 (let (current-load-list) ; c-r-s may call defvar, and hence LOADHIST_ATTACH
1121 (mapc 'custom-reevaluate-setting
1122 ;; Initialize them in the same order they were loaded, in case there
1123 ;; are dependencies between them.
1124 (prog1 (nreverse custom-delayed-init-variables)
1125 (setq custom-delayed-init-variables nil))))
1126
1118 ;; Warn for invalid user name. 1127 ;; Warn for invalid user name.
1119 (when init-file-user 1128 (when init-file-user
1120 (if (string-match "[~/:\n]" init-file-user) 1129 (if (string-match "[~/:\n]" init-file-user)
@@ -1245,15 +1254,6 @@ please check its value")
1245 (startup--setup-quote-display) 1254 (startup--setup-quote-display)
1246 (setq internal--text-quoting-flag t)) 1255 (setq internal--text-quoting-flag t))
1247 1256
1248 ;; Re-evaluate predefined variables whose initial value depends on
1249 ;; the runtime context.
1250 (let (current-load-list) ; c-r-s may call defvar, and hence LOADHIST_ATTACH
1251 (mapc 'custom-reevaluate-setting
1252 ;; Initialize them in the same order they were loaded, in case there
1253 ;; are dependencies between them.
1254 (prog1 (nreverse custom-delayed-init-variables)
1255 (setq custom-delayed-init-variables nil))))
1256
1257 (normal-erase-is-backspace-setup-frame) 1257 (normal-erase-is-backspace-setup-frame)
1258 1258
1259 ;; Register default TTY colors for the case the terminal hasn't a 1259 ;; Register default TTY colors for the case the terminal hasn't a