summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/package.el
diff options
context:
space:
mode:
authorAndrea Corallo <akrl@sdf.org>2021-03-19 15:28:00 +0100
committerAndrea Corallo <akrl@sdf.org>2021-03-19 15:28:00 +0100
commit6ca6c71cd0bf8fc970d9b1477ea61a670469f672 (patch)
tree98876b3f80794a8aad43293fbe005102e26e94f9 /lisp/emacs-lisp/package.el
parentb3ad62f8a35617366886be2a86e8641282824adf (diff)
parent3af2cee64b86e4ce59adb8e8720d92db35039cbc (diff)
downloademacs-6ca6c71cd0bf8fc970d9b1477ea61a670469f672.tar.gz
emacs-6ca6c71cd0bf8fc970d9b1477ea61a670469f672.tar.bz2
emacs-6ca6c71cd0bf8fc970d9b1477ea61a670469f672.zip
Merge remote-tracking branch 'savannah/master' into native-comp
Diffstat (limited to 'lisp/emacs-lisp/package.el')
-rw-r--r--lisp/emacs-lisp/package.el16
1 files changed, 10 insertions, 6 deletions
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index 059eda602c3..f1022f08f1b 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -2223,10 +2223,13 @@ directory."
(package-install-from-buffer)))
;;;###autoload
-(defun package-install-selected-packages ()
+(defun package-install-selected-packages (&optional noconfirm)
"Ensure packages in `package-selected-packages' are installed.
-If some packages are not installed propose to install them."
+If some packages are not installed, propose to install them.
+If optional argument NOCONFIRM is non-nil, don't ask for
+confirmation to install packages."
(interactive)
+ (package--archives-initialize)
;; We don't need to populate `package-selected-packages' before
;; using here, because the outcome is the same either way (nothing
;; gets installed).
@@ -2237,10 +2240,11 @@ If some packages are not installed propose to install them."
(difference (- (length not-installed) (length available))))
(cond
(available
- (when (y-or-n-p
- (format "Packages to install: %d (%s), proceed? "
- (length available)
- (mapconcat #'symbol-name available " ")))
+ (when (or noconfirm
+ (y-or-n-p
+ (format "Packages to install: %d (%s), proceed? "
+ (length available)
+ (mapconcat #'symbol-name available " "))))
(mapc (lambda (p) (package-install p 'dont-select)) available)))
((> difference 0)
(message "Packages that are not available: %d (the rest is already installed), maybe you need to `M-x package-refresh-contents'"