Refresh package list without blocking

* lisp/emacs-lisp/package.el (package-refresh-contents): Run
asynchronously when invoked interactively.
* etc/NEWS: Mention the change.
This commit is contained in:
Philip Kaludercic 2025-01-31 08:55:02 +01:00
parent a0e1115caa
commit 4cc8709ac2
No known key found for this signature in database
2 changed files with 9 additions and 2 deletions

View file

@ -1096,6 +1096,10 @@ removing packages.
When invoked with a prefix argument, 'package-install-selected-packages'
will not prompt the user for confirmation before installing packages.
---
*** 'package-refresh-contents' runs asynchronously
Refreshing the package index will not block when invoked interactively.
** Xref
---

View file

@ -1858,8 +1858,11 @@ For each archive configured in the variable `package-archives',
inform Emacs about the latest versions of all packages it offers,
and make them available for download.
Optional argument ASYNC specifies whether to perform the
downloads in the background."
(interactive)
downloads in the background. This is always the case when the command
is invoked interactively."
(interactive (list t))
(when async
(message "Refreshing package contents..."))
(unless (file-exists-p package-user-dir)
(make-directory package-user-dir t))
(let ((default-keyring (expand-file-name "package-keyring.gpg"