summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/package.el
diff options
context:
space:
mode:
authorYuuki Harano <masm+github@masm11.me>2021-03-21 15:54:46 +0900
committerYuuki Harano <masm+github@masm11.me>2021-03-21 15:54:46 +0900
commit5d2f319eec33fea2cb29a02210952ee590b4b21b (patch)
tree8dd6a5502f4cedcc060598ce0c8a3ef6e8688b6a /lisp/emacs-lisp/package.el
parent7a7bc15242896b20c7af49f77f0e22c3d78e4d88 (diff)
parente9e691093ab843911b0ac7a9a9188d477415db2e (diff)
downloademacs-5d2f319eec33fea2cb29a02210952ee590b4b21b.tar.gz
emacs-5d2f319eec33fea2cb29a02210952ee590b4b21b.tar.bz2
emacs-5d2f319eec33fea2cb29a02210952ee590b4b21b.zip
Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs into feature/pgtk
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 0973963af22..2ecd92cee9d 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -2206,10 +2206,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).
@@ -2220,10 +2223,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'"