Function: package-refresh-contents
package-refresh-contents is an autoloaded, interactive and
byte-compiled function defined in package.el.gz.
Signature
(package-refresh-contents &optional ASYNC)
Documentation
Download descriptions of all configured ELPA packages.
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. This is always the case when the command
is invoked interactively.
Probably introduced at or before Emacs version 31.1.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/emacs-lisp/package.el.gz
;;;###autoload
(defun package-refresh-contents (&optional async)
"Download descriptions of all configured ELPA packages.
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. 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"
data-directory))
(inhibit-message (or inhibit-message async)))
(when (and (package-check-signature) (file-exists-p default-keyring))
(condition-case-unless-debug error
(package-import-keyring default-keyring)
(error (message "Cannot import default keyring: %s"
(error-message-string error))))))
(run-hook-with-args 'package-refresh-contents-hook async))