bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#53527: 29.0.50; package-reinstall fails to initialize (enough of) pa


From: Matt Armstrong
Subject: bug#53527: 29.0.50; package-reinstall fails to initialize (enough of) package.el
Date: Tue, 25 Jan 2022 11:54:40 -0800

tags 53527 + patch
quit

This is one way to fix it.  Another would have been to call
`package--alist' instead of reference `package-alist' in
`package-reinstall'.  ...but that wouldn't have been an optimization,
since `package-install' inevitably calls `package--archives-initialize'
anyway.  This patch just makes it happen earlier.

>From fdf15b2985d237a70277362ad0b7d771f20c5f38 Mon Sep 17 00:00:00 2001
From: Matt Armstrong <matt@rfc20.org>
Date: Tue, 25 Jan 2022 11:22:10 -0800
Subject: [PATCH] Fix calling `package-reinstall' just after quick
 initialization.

* lisp/emacs-lisp/package.el (package-reinstall): call
`package--archives-initialize', just like `package-install' does.
This populates `package-alist', and so fixes calling
`package-reinstall' as the first thing done after package "quick
init".  (Bug#53527)
---
 lisp/emacs-lisp/package.el | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index 7679ba2fae..6a8692c983 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -2379,10 +2379,14 @@ package-reinstall
   "Reinstall package PKG.
 PKG should be either a symbol, the package name, or a `package-desc'
 object."
-  (interactive (list (intern (completing-read
-                              "Reinstall package: "
-                              (mapcar #'symbol-name
-                                      (mapcar #'car package-alist))))))
+  (interactive
+   (progn
+     (package--archives-initialize)
+     (list (intern (completing-read
+                    "Reinstall package: "
+                    (mapcar #'symbol-name
+                            (mapcar #'car package-alist)))))))
+  (package--archives-initialize)
   (package-delete
    (if (package-desc-p pkg) pkg (cadr (assq pkg package-alist)))
    'force 'nosave)
-- 
2.34.1


reply via email to

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