unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Matt Armstrong <matt@rfc20.org>
To: 53527@debbugs.gnu.org
Subject: bug#53527: 29.0.50; package-reinstall fails to initialize (enough of) package.el
Date: Tue, 25 Jan 2022 11:54:40 -0800	[thread overview]
Message-ID: <87ee4vr3pb.fsf@rfc20.org> (raw)
In-Reply-To: <87zgnjzpe9.fsf@rfc20.org>

[-- Attachment #1: Type: text/plain, Size: 335 bytes --]

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.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Patch to fix Bug#53527 --]
[-- Type: text/x-diff, Size: 1538 bytes --]

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	other threads:[~2022-01-25 19:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-25 17:38 bug#53527: 29.0.50; package-reinstall fails to initialize (enough of) package.el Matt Armstrong
2022-01-25 19:54 ` Matt Armstrong [this message]
2022-09-08 13:33   ` Lars Ingebrigtsen
2022-10-06  4:31     ` Matt Armstrong
2022-10-06 12:08       ` Lars Ingebrigtsen

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=87ee4vr3pb.fsf@rfc20.org \
    --to=matt@rfc20.org \
    --cc=53527@debbugs.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).