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

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

[elpa] externals/agitate 496eba8497 52/67: Add agitate-vc-git-show proto


From: ELPA Syncer
Subject: [elpa] externals/agitate 496eba8497 52/67: Add agitate-vc-git-show prototype
Date: Wed, 28 Sep 2022 16:57:29 -0400 (EDT)

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

    Add agitate-vc-git-show prototype
---
 README.org |  5 +++++
 agitate.el | 18 +++++++++++++-----
 2 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/README.org b/README.org
index e3fc949a8c..17d9b61f30 100644
--- a/README.org
+++ b/README.org
@@ -148,6 +148,11 @@ think most of those are superfluous.  Less is more.
 :CUSTOM_ID: h:f1a1f462-b6db-415a-b8e6-ba23788cb6e3
 :END:
 
+#+findex: agitate-vc-git-show
++ ~agitate-vc-git-show~ :: PROTOTYPE.  Prompt for commit and run
+  =git-show(1)= on it. With optional =CURRENT-FILE= as prefix
+  argument, limit the commits to those pertaining to the current file.
+
 #+findex: agitate-vc-git-grep
 + ~agitate-vc-git-grep~ :: Run ~git-grep(1)~ for =REGEXP= in
   ~vc-root-dir~.  This is a simple wrapper around ~vc-git-grep~ to
diff --git a/agitate.el b/agitate.el
index c37ea99cba..cdc903371e 100644
--- a/agitate.el
+++ b/agitate.el
@@ -255,14 +255,22 @@ With optional FILE, limit the commits to those pertinent 
to it."
   "Buffer for showing a git commit.")
 
 ;;;###autoload
-(defun vc-git-show ()
-  "PROOF OF CONCEPT."
-  (interactive)
+(defun agitate-vc-git-show (&optional current-file)
+  "PROTOTYPE.
+
+Prompt for commit and run `git-show(1)' on it.
+With optional CURRENT-FILE as prefix argument, limit the commits
+to those pertaining to the current file."
+  (interactive "P")
   (when-let* ((file (caadr (vc-deduce-fileset))) ; FIXME 2022-09-27: Better 
way to get current file?
               (revision (agitate--vc-git-get-hash-from-string
-                         (agitate--vc-git-commit-prompt file)))
+                         (agitate--vc-git-commit-prompt
+                          (when current-file file))))
               (buf "*agitate-vc-git-show*"))
-    (apply 'vc-git-command (get-buffer-create buf) nil file (list "show" 
revision))
+    (apply 'vc-git-command (get-buffer-create buf) nil (when current-file file)
+           (list "show" "--patch-with-stat" revision))
+    ;; TODO 2022-09-27: What else do we need to set up in such a
+    ;; buffer?
     (with-current-buffer (pop-to-buffer buf)
       (diff-mode))))
 



reply via email to

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