[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
scratch/package-vc-fixes e7e47b35b1 3/5: Improve robustness of 'package-
From: |
Philip Kaludercic |
Subject: |
scratch/package-vc-fixes e7e47b35b1 3/5: Improve robustness of 'package-vc-update' |
Date: |
Tue, 15 Nov 2022 04:46:45 -0500 (EST) |
branch: scratch/package-vc-fixes
commit e7e47b35b136fc9d7ac96e3a91ca83dab170e899
Author: Philip Kaludercic <philipk@posteo.net>
Commit: Philip Kaludercic <philipk@posteo.net>
Improve robustness of 'package-vc-update'
* lisp/emacs-lisp/package-vc.el (package-vc-update): Ensure that the
command is only invoked with installed packages. that the hook is
always removed and that 'vc-pull' is always called in the right
directory.
---
lisp/emacs-lisp/package-vc.el | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el
index 156e7576f6..fe54585b64 100644
--- a/lisp/emacs-lisp/package-vc.el
+++ b/lisp/emacs-lisp/package-vc.el
@@ -544,7 +544,7 @@ installed package."
(defun package-vc-update (pkg-desc)
"Attempt to update the package PKG-DESC."
- (interactive (list (package-vc--read-package-desc "Update source package:")))
+ (interactive (list (package-vc--read-package-desc "Update source package: "
t)))
;; HACK: To run `package-vc--unpack-1' after checking out the new
;; revision, we insert a hook into `vc-post-command-functions', and
;; remove it right after it ran. To avoid running the hook multiple
@@ -574,12 +574,14 @@ installed package."
(memq (nth 2 args) (list flags empty))
(or (eq (nth 3 args) empty)
(file-equal-p (nth 3 args) default-directory)))
- (with-demoted-errors "Failed to activate: %S"
- (package-vc--unpack-1 pkg-desc pkg-dir))
- (remove-hook 'vc-post-command-functions post-upgrade)))))
+ (unwind-protect
+ (with-demoted-errors "Failed to activate: %S"
+ (package-vc--unpack-1 pkg-desc pkg-dir))
+ (remove-hook 'vc-post-command-functions post-upgrade))))))
(add-hook 'vc-post-command-functions post-upgrade)
(with-demoted-errors "Failed to fetch: %S"
- (vc-pull))))
+ (let ((default-directory pkg-dir))
+ (vc-pull)))))
(defun package-vc--archives-initialize ()
"Initialize package.el and fetch package specifications."