]> git.eshelyaron.com Git - emacs.git/commitdiff
Don't use with-demoted-errors in use-package-ensure-elpa
authorJonas Bernoulli <jonas@bernoul.li>
Fri, 13 Oct 2017 12:08:06 +0000 (14:08 +0200)
committerJonas Bernoulli <jonas@bernoul.li>
Fri, 13 Oct 2017 12:08:06 +0000 (14:08 +0200)
It expects a literal string as argument at macro-expansion
time, but we need to construct the message.

lisp/use-package/use-package.el

index 78321621a07e22a6d894357e21d08c0628a88f30..4720c072ba66bee764550a191d9f4e8f50b7e0f2 100644 (file)
@@ -737,17 +737,20 @@ If the package is installed, its entry is removed from
                 ;; bypassed.
                 (member context '(:byte-compile :ensure :config))
                 (y-or-n-p (format "Install package %S?" package))))
-          (with-demoted-errors (format "Cannot load %s: %%S" name)
-            (when (assoc package (bound-and-true-p package-pinned-packages))
-              (package-read-all-archive-contents))
-            (if (assoc package package-archive-contents)
-                (progn (package-install package) t)
+          (condition-case-unless-debug err
               (progn
-                (package-refresh-contents)
-                (when (assoc package (bound-and-true-p
-                                      package-pinned-packages))
+                (when (assoc package (bound-and-true-p package-pinned-packages))
                   (package-read-all-archive-contents))
-                (package-install package))))))))
+                (if (assoc package package-archive-contents)
+                    (progn (package-install package) t)
+                  (progn
+                    (package-refresh-contents)
+                    (when (assoc package (bound-and-true-p
+                                          package-pinned-packages))
+                      (package-read-all-archive-contents))
+                    (package-install package))))
+            (error (message "Error: Cannot load %s: %S" name err)
+                   nil))))))
 
 (defun use-package-handler/:ensure (name keyword ensure rest state)
   (let* ((body (use-package-process-keywords name rest