]> git.eshelyaron.com Git - emacs.git/commitdiff
Remove old VC packages from 'package-alist' after installing
authorPhilip Kaludercic <philipk@posteo.net>
Sat, 9 Dec 2023 09:03:37 +0000 (10:03 +0100)
committerEshel Yaron <me@eshelyaron.com>
Sat, 9 Dec 2023 19:14:14 +0000 (20:14 +0100)
* lisp/emacs-lisp/package-vc.el (package-vc--unpack-1): Wait for all
system operations to have been completed, before proceeding to remove
old package descriptors from 'package-alist'.  This avoids loosing a
package if an error occurs during upgrades.

lisp/emacs-lisp/package-vc.el

index 645257cc38a6a78f42547ae4977c27b3160185dc..bc36762cb2d0f4b39290f27166f8a1475a8b30d1 100644 (file)
@@ -503,10 +503,6 @@ identify a package as a VC package later on), building
 documentation and marking the package as installed."
   (let ((pkg-spec (package-vc--desc->spec pkg-desc))
         missing)
-    ;; Remove any previous instance of PKG-DESC from `package-alist'
-    (let ((pkgs (assq (package-desc-name pkg-desc) package-alist)))
-      (when pkgs
-        (setf (cdr pkgs) (seq-remove #'package-vc-p (cdr pkgs)))))
 
     ;; In case the package was installed directly from source, the
     ;; dependency list wasn't know beforehand, and they might have
@@ -576,6 +572,11 @@ documentation and marking the package as installed."
         (dolist (doc-file (ensure-list (plist-get pkg-spec :doc)))
           (package-vc--build-documentation pkg-desc doc-file))))
 
+    ;; Remove any previous instance of PKG-DESC from `package-alist'
+    (let ((pkgs (assq (package-desc-name pkg-desc) package-alist)))
+      (when pkgs
+        (setf (cdr pkgs) (seq-remove #'package-vc-p (cdr pkgs)))))
+
     ;; Update package-alist.
     (let ((new-desc (package-load-descriptor pkg-dir)))
       ;; Activation has to be done before compilation, so that if we're