branch: externals/async
commit 2276bccd622b998ed3633da1d54f0e13c788fcfd
Author: Thierry Volpiatto <thie...@posteo.net>
Commit: Thierry Volpiatto <thie...@posteo.net>

    Only load the new or upgraded packages
---
 async-package.el | 47 +++++++++++++++++++++++------------------------
 1 file changed, 23 insertions(+), 24 deletions(-)

diff --git a/async-package.el b/async-package.el
index 6773e1da06..6ae6892c84 100644
--- a/async-package.el
+++ b/async-package.el
@@ -98,32 +98,31 @@ Argument ERROR-FILE is the file where errors are logged, if 
some."
               (delete-file error-file)
               (async-package--modeline-mode -1))
           (when result
-            (when (eq action 'install)
-              (let ((pkgs (when result
-                            (if (listp result) result (list result)))))
+            (let ((pkgs (if (listp result) result (list result))))
+              (when (eq action 'install)
                 (customize-save-variable
                  'package-selected-packages
-                 (delete-dups (append pkgs package-selected-packages)))))
-            (package-activate-all) ; load packages.
-            (async-package--modeline-mode -1)
-            (message "%s %s packages done" action-string (length packages))
-            (run-with-timer
-             0.1 nil
-             (lambda (lst str)
-               (dired-async-mode-line-message
-                "%s %d package(s) done"
-                'async-package-message
-                str (length lst)))
-             packages action-string)
-            (when (file-exists-p async-byte-compile-log-file)
-              (let ((buf (get-buffer-create byte-compile-log-buffer)))
-                (with-current-buffer buf
-                  (goto-char (point-max))
-                  (let ((inhibit-read-only t))
-                    (insert-file-contents async-byte-compile-log-file)
-                    (compilation-mode))
-                  (display-buffer buf)
-                  (delete-file async-byte-compile-log-file))))))))
+                 (delete-dups (append pkgs package-selected-packages))))
+              (mapc #'package-activate pkgs)    ; load packages.
+              (async-package--modeline-mode -1)
+              (message "%s %s packages done" action-string (length packages))
+              (run-with-timer
+               0.1 nil
+               (lambda (lst str)
+                 (dired-async-mode-line-message
+                  "%s %d package(s) done"
+                  'async-package-message
+                  str (length lst)))
+               packages action-string)
+              (when (file-exists-p async-byte-compile-log-file)
+                (let ((buf (get-buffer-create byte-compile-log-buffer)))
+                  (with-current-buffer buf
+                    (goto-char (point-max))
+                    (let ((inhibit-read-only t))
+                      (insert-file-contents async-byte-compile-log-file)
+                      (compilation-mode))
+                    (display-buffer buf)
+                    (delete-file async-byte-compile-log-file)))))))))
      'async-pkg-install t)
     (async-package--modeline-mode 1)))
 

Reply via email to