[Top][All Lists]

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

Re: [PATCH] Only signal package.el warnings when needed

From: Stefan Monnier
Subject: Re: [PATCH] Only signal package.el warnings when needed
Date: Mon, 14 Jan 2019 14:55:31 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

> In January 2018, we added support for an early init-file to Emacs 27,
> and adjusted Emacs startup to invoke `package-initialize' before
> loading the standard init-file (but after loading the early
> init-file).

Actually, the startup code calls package-activate-all.

Currently, this ends up calling package-initialize but I think it's
a mistake: package-initialize does two things (activate all packages,
and load the information about the various packages available in ELPA
archives) and only one of the two (the activation of all packages)
should be done at that point.

I think we should install a patch like the one below to deal with this.
It will reduce the number of variables that need to be set in
early-init.el, and will avoid problems where some packages end up
appearing incorrectly as new (because package-initialize at startup
didn't know about some ELPA archive, so when we "refresh" the contents,
all the packages in that archive are suddenly considered to be new).

> However, it is easy to address this complication: simply keep track of
> the values of these user options. If one or more of them has changed
> since the last time `package-initialize' was invoked, then perform the
> initialization a second time (and signal a warning).

Agreed (tho I wouldn't even emit a warning in that case).


diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index cf39fa2896..b8242e58f6 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -1492,8 +1492,8 @@ package-activate-all
       ;; any decoding).
       (let ((load-source-file-function nil))
         (load package-quickstart-file))
-    (unless package--initialized
-      (package-initialize t))
+    (unless package-alist
+      (package-load-all-descriptors))
     (dolist (elt package-alist)
       (condition-case err
           (package-activate (car elt))

reply via email to

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