From: Radon Rosborough <radon.neon@gmail.com>
To: "Clément Pit-Claudel" <cpitclaudel@gmail.com>
Cc: emacs-devel <emacs-devel@gnu.org>
Subject: Re: [PATCH] Various fixes for early init file changes
Date: Sat, 3 Mar 2018 10:02:58 -0800 [thread overview]
Message-ID: <CADB4rJFK1k6nzk0kPmLCuk+8owVJGn01S_ZRsW-fgugf3iw-8w@mail.gmail.com> (raw)
In-Reply-To: <501946bf-71fc-aed1-222b-df46ea84ec3e@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 101 bytes --]
> This parenthesis confused me a bit at first
>
> […]
>
> Maybe just "warn"?
OK, attached.
[-- Attachment #2: 0001-Documentation-fixes-for-early-init-file-changes.patch --]
[-- Type: application/octet-stream, Size: 4621 bytes --]
From d29c0d42697a56ad1cd58a0cc8feacee24017ec5 Mon Sep 17 00:00:00 2001
From: Radon Rosborough <radon.neon@gmail.com>
Date: Fri, 2 Mar 2018 20:33:34 -0800
Subject: [PATCH] Documentation fixes 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 [1].
* 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 [2].
(package-load-list): Refer to "making available" rather than "loading"
for packages. See [3].
[1]: https://lists.nongnu.org/archive/html/bug-gnu-emacs/2018-02/msg00827.html
[2]: https://lists.gnu.org/archive/html/emacs-devel/2018-02/msg00632.html
[3]: https://lists.gnu.org/archive/html/emacs-devel/2018-02/msg00298.html
---
doc/emacs/custom.texi | 10 +++++++---
lisp/emacs-lisp/package.el | 27 ++++++++++++++++-----------
2 files changed, 23 insertions(+), 14 deletions(-)
diff --git a/doc/emacs/custom.texi b/doc/emacs/custom.texi
index 0905ae7bb1..2ec922ea6a 100644
--- a/doc/emacs/custom.texi
+++ b/doc/emacs/custom.texi
@@ -2606,9 +2606,13 @@ Early Init File
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}.
-@xref{Package Installation}.
+you can customize variables that affect the package initialization
+process, such as @code{package-enable-at-startup},
+@code{package-load-list}, 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 999e0d0752..6c307cc37c 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -161,29 +161,34 @@ package
;;; 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")
--
2.16.2
[-- Attachment #3: 0001-Fix-Info-default-directory-list-error-during-init.patch --]
[-- Type: application/octet-stream, Size: 2197 bytes --]
From b61d09e08302c7441e1f2301287b5fcff4303ecd Mon Sep 17 00:00:00 2001
From: Radon Rosborough <radon.neon@gmail.com>
Date: Fri, 2 Mar 2018 20:55:48 -0800
Subject: [PATCH] Fix Info-default-directory-list error during init
* 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 [1].
[1]: https://lists.gnu.org/archive/html/emacs-devel/2018-02/msg00545.html
---
lisp/startup.el | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/lisp/startup.el b/lisp/startup.el
index 4105c1db2d..2669342eda 100644
--- a/lisp/startup.el
+++ b/lisp/startup.el
@@ -1115,6 +1115,15 @@ command-line
(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 @@ command-line
(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
--
2.16.2
[-- Attachment #4: 0001-Warn-if-package-initialize-is-called-twice.patch --]
[-- Type: application/octet-stream, Size: 1659 bytes --]
From fa6a7badc64edd2e2c098b538053a622b11e91d4 Mon Sep 17 00:00:00 2001
From: Radon Rosborough <radon.neon@gmail.com>
Date: Fri, 2 Mar 2018 21:06:53 -0800
Subject: [PATCH] Warn if `package-initialize' is called twice
* lisp/emacs-lisp/package.el (package-warn-on-reinitialization): New
variable.
(package-initialize): Conditionally signal a warning.
See: https://lists.gnu.org/archive/html/emacs-devel/2018-02/msg00626.html
---
lisp/emacs-lisp/package.el | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index 6c307cc37c..d821596216 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -175,6 +175,13 @@ package-enable-at-startup
:type 'boolean
:version "24.1")
+(defcustom package-warn-on-reinitialization t
+ "Whether to warn when `package-initialize' is called twice.
+This only warns if `package-initialize' is called more than once
+before Emacs startup has completed."
+ :type 'boolean
+ :version "27.1")
+
(defcustom package-load-list '(all)
"List of packages for `package-initialize' to make available.
Each element in this list should be a list (NAME VERSION), or the
@@ -1448,6 +1455,10 @@ package-initialize
individual packages after calling `package-initialize' -- this is
taken care of by `package-initialize'."
(interactive)
+ (when (and package--initialized
+ (not after-init-time)
+ package-warn-on-reinitialization)
+ (warn "Unnecessary call to `package-initialize' in init file"))
(setq package-alist nil)
(setq package-enable-at-startup nil)
(package-load-all-descriptors)
--
2.16.2
next prev parent reply other threads:[~2018-03-03 18:02 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-03 5:31 [PATCH] Various fixes for early init file changes Radon Rosborough
2018-03-03 17:26 ` Clément Pit-Claudel
2018-03-03 18:02 ` Radon Rosborough [this message]
2018-03-09 1:30 ` Noam Postavsky
2018-03-09 6:07 ` Radon Rosborough
2018-03-09 13:16 ` Noam Postavsky
2018-03-19 8:46 ` Eli Zaretskii
2018-03-19 10:06 ` Robert Pluim
2018-03-19 16:20 ` Radon Rosborough
2018-03-19 16:29 ` Stefan Monnier
2018-03-19 16:34 ` Radon Rosborough
2018-03-19 16:38 ` Stefan Monnier
2018-03-19 20:14 ` Radon Rosborough
2018-03-19 17:02 ` Drew Adams
2018-03-19 20:16 ` Radon Rosborough
2018-03-19 22:14 ` Clément Pit-Claudel
2018-03-20 5:44 ` Radon Rosborough
2018-03-20 5:53 ` Clément Pit-Claudel
2018-03-20 16:08 ` Andy Moreton
2018-03-20 16:36 ` Radon Rosborough
2018-03-20 16:42 ` Robert Pluim
2018-03-20 19:44 ` Radon Rosborough
2018-03-21 9:00 ` Robert Pluim
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CADB4rJFK1k6nzk0kPmLCuk+8owVJGn01S_ZRsW-fgugf3iw-8w@mail.gmail.com \
--to=radon.neon@gmail.com \
--cc=cpitclaudel@gmail.com \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).