[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] feature/gnus-select 31b6fa0 115/218: Various follow-ups fo
From: |
Andrew G Cohen |
Subject: |
[Emacs-diffs] feature/gnus-select 31b6fa0 115/218: Various follow-ups for early init file changes |
Date: |
Fri, 14 Dec 2018 03:35:12 -0500 (EST) |
branch: feature/gnus-select
commit 31b6fa0a4914ab50446ac0ee1f2800f389211849
Author: Radon Rosborough <address@hidden>
Commit: Andrew G Cohen <address@hidden>
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
---
doc/emacs/custom.texi | 10 +++++++---
lisp/emacs-lisp/package.el | 40 ++++++++++++++++++++++++++++------------
lisp/startup.el | 18 +++++++++---------
3 files changed, 44 insertions(+), 24 deletions(-)
diff --git a/doc/emacs/custom.texi b/doc/emacs/custom.texi
index be73d7a..a69888c 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
earlier than the normal init file is processed. Such customizations
can be put in the early init file, @file{~/.emacs.d/early-init.el}.
This file is loaded before the package system is initialized, so in it
-you can customize variables that affect the initialization process,
-such as @code{package-enable-at-startup} and @code{package-load-list}.
address@hidden Installation}.
+you can customize variables that affect the package initialization
+process, such as @code{package-enable-at-startup},
address@hidden, and @code{package-user-dir}. Note that
+variables like @code{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. @xref{Package Installation}.
For more information on the early init file, @pxref{Init File,,,
elisp, The Emacs Lisp Reference Manual}.
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index 999e0d0..1edc06d 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -161,29 +161,34 @@
;;; Customization options
;;;###autoload
(defcustom package-enable-at-startup t
- "Whether to activate installed packages when Emacs starts.
-If non-nil, packages are activated after reading the init file
-and before `after-init-hook'. Activation is not done if
-`user-init-file' is nil (e.g. Emacs was started with \"-q\").
+ "Whether to make installed packages available when Emacs starts.
+If non-nil, packages are made available before reading the init
+file (but after reading the early init file). This means that if
+you wish to set this variable, you must do so in the early init
+file. Regardless of the value of this variable, packages are not
+made available if `user-init-file' is nil (e.g. Emacs was started
+with \"-q\").
Even if the value is nil, you can type \\[package-initialize] to
-activate the package system at any time."
+make installed packages available at any time, or you can
+call (package-initialize) in your init-file."
:type 'boolean
:version "24.1")
(defcustom package-load-list '(all)
- "List of packages for `package-initialize' to load.
+ "List of packages for `package-initialize' to make available.
Each element in this list should be a list (NAME VERSION), or the
-symbol `all'. The symbol `all' says to load the latest installed
-versions of all packages not specified by other elements.
+symbol `all'. The symbol `all' says to make available the latest
+installed versions of all packages not specified by other
+elements.
For an element (NAME VERSION), NAME is a package name (a symbol).
VERSION should be t, a string, or nil.
-If VERSION is t, the most recent version is activated.
-If VERSION is a string, only that version is ever loaded.
+If VERSION is t, the most recent version is made available.
+If VERSION is a string, only that version is ever made available.
Any other version, even if newer, is silently ignored.
Hence, the package is \"held\" at that version.
-If VERSION is nil, the package is not loaded (it is \"disabled\")."
+If VERSION is nil, the package is not made available (it is \"disabled\")."
:type '(repeat (choice (const all)
(list :tag "Specific package"
(symbol :tag "Package name")
@@ -1439,10 +1444,21 @@ If optional arg NO-ACTIVATE is non-nil, don't activate
packages.
If called as part of loading `user-init-file', set
`package-enable-at-startup' to nil, to prevent accidentally
loading packages twice.
+
It is not necessary to adjust `load-path' or `require' the
individual packages after calling `package-initialize' -- this is
-taken care of by `package-initialize'."
+taken care of by `package-initialize'.
+
+If `package-initialize' is called twice during Emacs startup,
+signal a warning, since this is a bad idea except in highly
+advanced use cases. To suppress the warning, remove the
+superfluous call to `package-initialize' from your init-file. If
+you have code which must run before `package-initialize', put
+that code in the early init-file."
(interactive)
+ (when (and package--initialized (not after-init-time))
+ (lwarn '(package reinitialization) :warning
+ "Unnecessary call to `package-initialize' in init file"))
(setq package-alist nil)
(setq package-enable-at-startup nil)
(package-load-all-descriptors)
diff --git a/lisp/startup.el b/lisp/startup.el
index 4105c1d..2669342 100644
--- a/lisp/startup.el
+++ b/lisp/startup.el
@@ -1115,6 +1115,15 @@ please check its value")
(and command-line-args
(setcdr command-line-args args)))
+ ;; 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
+ ;; 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))))
+
;; Warn for invalid user name.
(when init-file-user
(if (string-match "[~/:\n]" init-file-user)
@@ -1245,15 +1254,6 @@ please check its value")
(startup--setup-quote-display)
(setq internal--text-quoting-flag t))
- ;; 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
- ;; 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))))
-
(normal-erase-is-backspace-setup-frame)
;; Register default TTY colors for the case the terminal hasn't a
- [Emacs-diffs] feature/gnus-select 73ee8d2 181/218: * doc/lispref/buffers.texi (Buffer List): Fix grammar., (continued)
- [Emacs-diffs] feature/gnus-select 73ee8d2 181/218: * doc/lispref/buffers.texi (Buffer List): Fix grammar., Andrew G Cohen, 2018/12/14
- [Emacs-diffs] feature/gnus-select 233bfb5 209/218: Fix byte-optimize-memq incorrectly optimizing some memq forms., Andrew G Cohen, 2018/12/14
- [Emacs-diffs] feature/gnus-select 7d929e5 098/218: Another followup to fixing 'window-text-pixel-width', Andrew G Cohen, 2018/12/14
- [Emacs-diffs] feature/gnus-select c5d9d8b 101/218: Quieten semantic re-compilation when .elc already exist, Andrew G Cohen, 2018/12/14
- [Emacs-diffs] feature/gnus-select 3a01434 108/218: * lisp/emacs-lisp/ert.el (ert-run-tests-batch): Print selector., Andrew G Cohen, 2018/12/14
- [Emacs-diffs] feature/gnus-select 43af089 113/218: * lisp/url/url-handlers.el: No need for subr-x at run-time., Andrew G Cohen, 2018/12/14
- [Emacs-diffs] feature/gnus-select 9e3f6aa 104/218: Explicitly require cl-lib where needed, Andrew G Cohen, 2018/12/14
- [Emacs-diffs] feature/gnus-select 1d789ec 117/218: Allow 'browse-url-emacs' to fetch URL in the selected window, Andrew G Cohen, 2018/12/14
- [Emacs-diffs] feature/gnus-select 9c19d2d 116/218: Fix typo in the Emacs manual's VC chapter, Andrew G Cohen, 2018/12/14
- [Emacs-diffs] feature/gnus-select d448a99 124/218: ; Spelling fix, Andrew G Cohen, 2018/12/14
- [Emacs-diffs] feature/gnus-select 31b6fa0 115/218: Various follow-ups for early init file changes,
Andrew G Cohen <=
- [Emacs-diffs] feature/gnus-select d5087f9 131/218: ; * test/lisp/info-xref-tests.el: Remove stray line from previous., Andrew G Cohen, 2018/12/14
- [Emacs-diffs] feature/gnus-select 44c15fe 133/218: ; Spelling fix, Andrew G Cohen, 2018/12/14
- [Emacs-diffs] feature/gnus-select 3b15508 136/218: * lisp/textmodes/bibtex.el (bibtex-mark-entry): activate mark, Andrew G Cohen, 2018/12/14
- [Emacs-diffs] feature/gnus-select 7387d26 144/218: Port to 32-bit sparc64, Andrew G Cohen, 2018/12/14
- [Emacs-diffs] feature/gnus-select 06a984e 138/218: Improve documentation of 'with-help-window', Andrew G Cohen, 2018/12/14
- [Emacs-diffs] feature/gnus-select 4523701 147/218: * lisp/isearch.el (isearch-pre-command-hook): Replace cl-lib function., Andrew G Cohen, 2018/12/14
- [Emacs-diffs] feature/gnus-select 751ecf3 135/218: Set gnus-newsgroup-selection in the summary buffer, Andrew G Cohen, 2018/12/14
- [Emacs-diffs] feature/gnus-select 16fc857 142/218: ; Rewrap doc string, Andrew G Cohen, 2018/12/14
- [Emacs-diffs] feature/gnus-select 118f691 103/218: cedet: remove obsolete name args to constructors, Andrew G Cohen, 2018/12/14
- [Emacs-diffs] feature/gnus-select aa16566 168/218: Fix Bug#30904, Andrew G Cohen, 2018/12/14