]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/emacs-lisp/package.el (package-install-selected-packages):
authorArtur Malabarba <bruce.connor.am@gmail.com>
Mon, 4 Apr 2016 14:58:49 +0000 (11:58 -0300)
committerArtur Malabarba <bruce.connor.am@gmail.com>
Mon, 4 Apr 2016 15:31:19 +0000 (12:31 -0300)
Skip unavailable packages.

lisp/emacs-lisp/package.el

index b65e45b1bf68e50fbb49c4257f36478c8a1af5c8..29de2c9b07f0615d41dc37e8454ee895122bab30 100644 (file)
@@ -2023,17 +2023,21 @@ If some packages are not installed propose to install them."
   ;; gets installed).
   (if (not package-selected-packages)
       (message "`package-selected-packages' is empty, nothing to install")
-    (cl-loop for p in package-selected-packages
-             unless (package-installed-p p)
-             collect p into lst
-             finally
-             (if lst
-                 (when (y-or-n-p
-                        (format "%s packages will be installed:\n%s, proceed?"
-                          (length lst)
-                          (mapconcat #'symbol-name lst ", ")))
-                   (mapc #'package-install lst))
-               (message "All your packages are already installed")))))
+    (let* ((not-installed (seq-remove #'package-installed-p package-selected-packages))
+           (available (seq-filter (lambda (p) (assq p package-archive-contents)) not-installed))
+           (difference (- (length not-installed) (length available))))
+      (cond
+       (available
+        (when (y-or-n-p
+               (format "%s packages will be installed:\n%s, proceed?"
+                       (length available)
+                       (mapconcat #'symbol-name available ", ")))
+          (mapc (lambda (p) (package-install p 'dont-select)) available)))
+       ((> difference 0)
+        (message "%s packages are not available (the rest already installed), maybe you need to `M-x package-refresh-contents'"
+                 difference))
+       (t
+        (message "All your packages are already installed"))))))
 
 \f
 ;;; Package Deletion