emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 4f0239d814a: (package-activate-all): Be more robust when quicksta


From: Stefan Monnier
Subject: master 4f0239d814a: (package-activate-all): Be more robust when quickstart fails
Date: Tue, 5 Dec 2023 14:25:23 -0500 (EST)

branch: master
commit 4f0239d814a090a7d96968c0e8f70e56b186cff9
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>

    (package-activate-all): Be more robust when quickstart fails
    
    Quickstart can fail in all kinds of ways, for example if a package
    was removed without updating the quickstart file.
    
    * lisp/emacs-lisp/package.el (package-activate-all): Revert to the slow
    path if the quickstart signals an error.
    (package--activate-all): Fix compilation warning without an autoload.
---
 lisp/emacs-lisp/package.el | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)

diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index d4bb6710283..0a87f771ab9 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -1720,18 +1720,21 @@ The variable `package-load-list' controls which 
packages to load."
                    package-quickstart-file))))
     ;; The quickstart file presumes that it has a blank slate,
     ;; so don't use it if we already activated some packages.
-    (if (and qs (not (bound-and-true-p package-activated-list)))
-        ;; Skip load-source-file-function which would slow us down by a factor
-        ;; 2 when loading the .el file (this assumes we were careful to
-        ;; save this file so it doesn't need any decoding).
-        (let ((load-source-file-function nil))
-          (unless (boundp 'package-activated-list)
-            (setq package-activated-list nil))
-          (load qs nil 'nomessage))
-      (require 'package)
-      (package--activate-all)))))
+    (or (and qs (not (bound-and-true-p package-activated-list))
+             ;; Skip `load-source-file-function' which would slow us down by
+             ;; a factor 2 when loading the .el file (this assumes we were
+             ;; careful to save this file so it doesn't need any decoding).
+             (with-demoted-errors "Error during quickstart: %S"
+               (let ((load-source-file-function nil))
+                 (unless (boundp 'package-activated-list)
+                   (setq package-activated-list nil))
+                 (load qs nil 'nomessage)
+                 t)))
+        (progn
+          (require 'package)
+          (declare-function package--activate-all "package" ())
+          (package--activate-all))))))
 
-;;;###autoload
 (defun package--activate-all ()
   (dolist (elt (package--alist))
     (condition-case err



reply via email to

[Prev in Thread] Current Thread [Next in Thread]