emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals/agitate 39666a34b3: Add agitate--vc-git-show-revert hel


From: ELPA Syncer
Subject: [elpa] externals/agitate 39666a34b3: Add agitate--vc-git-show-revert helper
Date: Tue, 18 Oct 2022 22:57:16 -0400 (EDT)

branch: externals/agitate
commit 39666a34b3e132e6b1111b72dcc6381d86d5055b
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: Protesilaos Stavrou <info@protesilaos.com>

    Add agitate--vc-git-show-revert helper
---
 agitate.el | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/agitate.el b/agitate.el
index b667b90dfa..c4e11fef55 100644
--- a/agitate.el
+++ b/agitate.el
@@ -405,6 +405,14 @@ to browse through the file's history."
                           file))))
     (pop-to-buffer (vc-find-revision file revision (car fileset)))))
 
+(defun agitate--vc-git-show-revert (&rest args)
+  "Run `vc-git--call' with ARGS.
+This is a helper for git-show(1) `revert-buffer-function'."
+  (let ((inhibit-read-only t))
+    (erase-buffer)
+    (apply 'vc-git--call args)
+    (goto-char (point-min))))
+
 ;;;###autoload
 (defun agitate-vc-git-show (&optional current-file)
   "Prompt for commit and run `git-show(1)' on it.
@@ -433,10 +441,7 @@ to browse through the available commits."
         (diff-mode)
         (setq-local revert-buffer-function
                     (lambda (_ignore-auto _noconfirm)
-                      (let ((inhibit-read-only t))
-                        (erase-buffer)
-                        (vc-git--call buf "show" "--patch-with-stat" revision)
-                        (goto-char (point-min)))))
+                        (agitate--vc-git-show-revert buf "show" 
"--patch-with-stat" revision)))
         (goto-char (point-min))))))
 
 (defun agitate--vc-git-tag-prompt ()
@@ -470,9 +475,7 @@ to browse through the available tags."
       (setq-local revert-buffer-function
                   (lambda (_ignore-auto _noconfirm)
                     (let ((inhibit-read-only t))
-                      (erase-buffer)
-                      (vc-git--call buf "show" tag)
-                      (goto-char (point-min)))))
+                      (agitate--vc-git-show-revert buf "show" tag))))
       (goto-char (point-min)))))
 
 (defun agitate--vc-git-format-patch-single-commit ()



reply via email to

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