[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
scratch/package-vc-fixes bc9c7aee30 34/48: Improve robustness of 'packag
From: |
Philip Kaludercic |
Subject: |
scratch/package-vc-fixes bc9c7aee30 34/48: Improve robustness of 'package-vc-update' |
Date: |
Wed, 16 Nov 2022 04:50:06 -0500 (EST) |
branch: scratch/package-vc-fixes
commit bc9c7aee306c63755d9a16b60334715e2f99cb69
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 | 29 ++++++++++++-----------------
1 file changed, 12 insertions(+), 17 deletions(-)
diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el
index 156e7576f6..f025a963a4 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
@@ -558,28 +558,23 @@ installed package."
;;
;; If there is a better way to do this, it should be done.
(letrec ((pkg-dir (package-desc-dir pkg-desc))
- (empty (make-symbol "empty"))
- (args (list empty empty empty empty))
+ (vc-flags)
(vc-filter-command-function
(lambda (command file-or-list flags)
- (setf (nth 0 args) command
- (nth 1 args) file-or-list
- (nth 2 args) flags
- (nth 3 args) default-directory)
+ (setq vc-flags flags)
(list command file-or-list flags)))
(post-upgrade
- (lambda (command file-or-list flags)
- (when (and (memq (nth 0 args) (list command empty))
- (memq (nth 1 args) (list file-or-list empty))
- (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)))))
+ (lambda (_command _file-or-list flags)
+ (when (and (file-equal-p pkg-dir default-directory)
+ (eq flags vc-flags))
+ (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."
- branch scratch/package-vc-fixes created (now 18ee1e728a), Philip Kaludercic, 2022/11/16
- scratch/package-vc-fixes 5132a2b0d0 02/48: Handle strings as keys in 'package-vc-ensure-packages', Philip Kaludercic, 2022/11/16
- scratch/package-vc-fixes 2364faef93 32/48: Have 'vc-prepare-patch' handle prefix arguments., Philip Kaludercic, 2022/11/16
- scratch/package-vc-fixes aca27e0905 10/48: Expand 'package-vc--unpack-1' documentation, Philip Kaludercic, 2022/11/16
- scratch/package-vc-fixes 685b4b274b 08/48: Fix the docstring for 'package-vc--version', Philip Kaludercic, 2022/11/16
- scratch/package-vc-fixes c29189587b 07/48: Fix 'package-vc-selected-packages' documentation, Philip Kaludercic, 2022/11/16
- scratch/package-vc-fixes 6a46e7d3ee 17/48: Move package spec documentation to 'package-vc-selected-packages', Philip Kaludercic, 2022/11/16
- scratch/package-vc-fixes 58b2a64225 23/48: Fix edebug spec for 'package--with-response-buffer', Philip Kaludercic, 2022/11/16
- scratch/package-vc-fixes b45d2fb4b2 29/48: * lisp/emacs-lisp/package-vc.el (package-vc-update-all): Add command, Philip Kaludercic, 2022/11/16
- scratch/package-vc-fixes a10cd1b927 36/48: Fix accidental generation of circular lists, Philip Kaludercic, 2022/11/16
- scratch/package-vc-fixes bc9c7aee30 34/48: Improve robustness of 'package-vc-update',
Philip Kaludercic <=
- scratch/package-vc-fixes a89f7bc1dc 27/48: Raise 'wrong-type-argument' when installing package nil, Philip Kaludercic, 2022/11/16
- scratch/package-vc-fixes 4730409de9 38/48: Fix the behaviour or 'byte-compile-ignore-files', Philip Kaludercic, 2022/11/16
- scratch/package-vc-fixes 663cb70e15 40/48: Remove temporary .texi files if used to build documentation, Philip Kaludercic, 2022/11/16
- scratch/package-vc-fixes 6b35279259 45/48: Fix issues related to 'package-vc-install-from-checkout', Philip Kaludercic, 2022/11/16
- scratch/package-vc-fixes c383864f96 46/48: Have 'package-delete' handle symlinked packages correctly, Philip Kaludercic, 2022/11/16
- scratch/package-vc-fixes 7815894592 11/48: Remove references to internal symbols from public docstrings, Philip Kaludercic, 2022/11/16
- scratch/package-vc-fixes 2121ef0899 12/48: Fix generation of documentation for source packages, Philip Kaludercic, 2022/11/16
- scratch/package-vc-fixes 4b30679030 15/48: Explain what "refreshing" a source package means, Philip Kaludercic, 2022/11/16
- scratch/package-vc-fixes aab49e7baa 35/48: * lisp/emacs-lisp/package.el (package-lisp-dir): Fix return value, Philip Kaludercic, 2022/11/16
- scratch/package-vc-fixes aeb386007b 04/48: Mark 'package-vc-install-selected-packages' as interactive, Philip Kaludercic, 2022/11/16