diff options
| author | Radon Rosborough | 2018-03-02 21:06:53 -0800 |
|---|---|---|
| committer | Eli Zaretskii | 2018-03-19 10:44:40 +0200 |
| commit | 2db57579b08ac99c464b6d3698648b3167fc5d55 (patch) | |
| tree | d13a814f944a13cfea43c25e7310befc800f342f | |
| parent | 667cdf421ff64b1fe736f75e8a7f8864de1b5026 (diff) | |
| download | emacs-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.texi | 10 | ||||
| -rw-r--r-- | lisp/emacs-lisp/package.el | 40 | ||||
| -rw-r--r-- | lisp/startup.el | 18 |
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 | |||
| 2607 | earlier than the normal init file is processed. Such customizations | 2607 | earlier than the normal init file is processed. Such customizations |
| 2608 | can be put in the early init file, @file{~/.emacs.d/early-init.el}. | 2608 | can be put in the early init file, @file{~/.emacs.d/early-init.el}. |
| 2609 | This file is loaded before the package system is initialized, so in it | 2609 | This file is loaded before the package system is initialized, so in it |
| 2610 | you can customize variables that affect the initialization process, | 2610 | you can customize variables that affect the package initialization |
| 2611 | such as @code{package-enable-at-startup} and @code{package-load-list}. | 2611 | process, such as @code{package-enable-at-startup}, |
| 2612 | @xref{Package Installation}. | 2612 | @code{package-load-list}, and @code{package-user-dir}. Note that |
| 2613 | variables like @code{package-archives} which only affect the | ||
| 2614 | installation of new packages, and not the process of making | ||
| 2615 | already-installed packages available, may be customized in the regular | ||
| 2616 | init 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,,, |
| 2615 | elisp, The Emacs Lisp Reference Manual}. | 2619 | elisp, 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. |
| 165 | If non-nil, packages are activated after reading the init file | 165 | If non-nil, packages are made available before reading the init |
| 166 | and before `after-init-hook'. Activation is not done if | 166 | file (but after reading the early init file). This means that if |
| 167 | `user-init-file' is nil (e.g. Emacs was started with \"-q\"). | 167 | you wish to set this variable, you must do so in the early init |
| 168 | file. Regardless of the value of this variable, packages are not | ||
| 169 | made available if `user-init-file' is nil (e.g. Emacs was started | ||
| 170 | with \"-q\"). | ||
| 168 | 171 | ||
| 169 | Even if the value is nil, you can type \\[package-initialize] to | 172 | Even if the value is nil, you can type \\[package-initialize] to |
| 170 | activate the package system at any time." | 173 | make installed packages available at any time, or you can |
| 174 | call (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. |
| 176 | Each element in this list should be a list (NAME VERSION), or the | 180 | Each element in this list should be a list (NAME VERSION), or the |
| 177 | symbol `all'. The symbol `all' says to load the latest installed | 181 | symbol `all'. The symbol `all' says to make available the latest |
| 178 | versions of all packages not specified by other elements. | 182 | installed versions of all packages not specified by other |
| 183 | elements. | ||
| 179 | 184 | ||
| 180 | For an element (NAME VERSION), NAME is a package name (a symbol). | 185 | For an element (NAME VERSION), NAME is a package name (a symbol). |
| 181 | VERSION should be t, a string, or nil. | 186 | VERSION should be t, a string, or nil. |
| 182 | If VERSION is t, the most recent version is activated. | 187 | If VERSION is t, the most recent version is made available. |
| 183 | If VERSION is a string, only that version is ever loaded. | 188 | If 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. |
| 186 | If VERSION is nil, the package is not loaded (it is \"disabled\")." | 191 | If 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. | |||
| 1439 | If called as part of loading `user-init-file', set | 1444 | If 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 |
| 1441 | loading packages twice. | 1446 | loading packages twice. |
| 1447 | |||
| 1442 | It is not necessary to adjust `load-path' or `require' the | 1448 | It is not necessary to adjust `load-path' or `require' the |
| 1443 | individual packages after calling `package-initialize' -- this is | 1449 | individual packages after calling `package-initialize' -- this is |
| 1444 | taken care of by `package-initialize'." | 1450 | taken care of by `package-initialize'. |
| 1451 | |||
| 1452 | If `package-initialize' is called twice during Emacs startup, | ||
| 1453 | signal a warning, since this is a bad idea except in highly | ||
| 1454 | advanced use cases. To suppress the warning, remove the | ||
| 1455 | superfluous call to `package-initialize' from your init-file. If | ||
| 1456 | you have code which must run before `package-initialize', put | ||
| 1457 | that 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 |