emacs-diffs
[Top][All Lists]
Advanced

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

master 78698e9211 2/2: 'C-c C-d' on vc-log buffer shows the diff from 'v


From: Juri Linkov
Subject: master 78698e9211 2/2: 'C-c C-d' on vc-log buffer shows the diff from 'vc-log-fileset' (bug#52349)
Date: Sun, 28 Aug 2022 15:45:33 -0400 (EDT)

branch: master
commit 78698e9211ce642fb0ddeb63ce7d26339863d557
Author: Juri Linkov <juri@linkov.net>
Commit: Juri Linkov <juri@linkov.net>

    'C-c C-d' on vc-log buffer shows the diff from 'vc-log-fileset' (bug#52349)
    
    * lisp/vc/log-edit.el (log-edit-diff-fileset): New function.
    
    * lisp/vc/vc-dispatcher.el (vc-log-edit): Set log-edit-diff-function to
    log-edit-diff-fileset instead of vc-diff.
    
    * lisp/vc/vc.el (vc-diff): New optional arg ‘fileset’.
    If non-nil, use instead of vc-deduce-fileset.
---
 lisp/vc/log-edit.el      | 7 +++++++
 lisp/vc/vc-dispatcher.el | 2 +-
 lisp/vc/vc.el            | 7 ++++---
 3 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/lisp/vc/log-edit.el b/lisp/vc/log-edit.el
index 4a94553b21..5290616302 100644
--- a/lisp/vc/log-edit.el
+++ b/lisp/vc/log-edit.el
@@ -670,6 +670,13 @@ comment history, see `log-edit-comment-ring', and hides 
`log-edit-files-buf'."
 (defun log-edit-diff-patch ()
   (vc-diff-patch-string vc-patch-string))
 
+(defvar vc-log-fileset)
+
+(defun log-edit-diff-fileset ()
+  "Display diffs for the files to be committed."
+  (interactive)
+  (vc-diff nil nil (list log-edit-vc-backend vc-log-fileset)))
+
 (defun log-edit-show-diff ()
   "Show the diff for the files to be committed."
   (interactive)
diff --git a/lisp/vc/vc-dispatcher.el b/lisp/vc/vc-dispatcher.el
index df5bf1cfa6..36a6f27891 100644
--- a/lisp/vc/vc-dispatcher.el
+++ b/lisp/vc/vc-dispatcher.el
@@ -656,7 +656,7 @@ NOT-URGENT means it is ok to continue if the user says not 
to save."
                        (lambda (file) (file-relative-name file root))
                        fileset))))
              (log-edit-diff-function
-               . ,(if vc-patch-string 'log-edit-diff-patch 'vc-diff))
+               . ,(if vc-patch-string 'log-edit-diff-patch 
'log-edit-diff-fileset))
              (log-edit-vc-backend . ,backend)
              (vc-log-fileset . ,fileset)
              (vc-patch-string . ,vc-patch-string))
diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
index 88139fe13d..d93be951a3 100644
--- a/lisp/vc/vc.el
+++ b/lisp/vc/vc.el
@@ -2001,19 +2001,20 @@ state of each file in the fileset."
     (when buffer-file-name (vc-buffer-sync not-urgent))))
 
 ;;;###autoload
-(defun vc-diff (&optional historic not-urgent)
+(defun vc-diff (&optional historic not-urgent fileset)
   "Display diffs between file revisions.
 Normally this compares the currently selected fileset with their
 working revisions.  With a prefix argument HISTORIC, it reads two revision
 designators specifying which revisions to compare.
 
 The optional argument NOT-URGENT non-nil means it is ok to say no to
-saving the buffer."
+saving the buffer.  The optional argument FILESET can override the
+deduced fileset."
   (interactive (list current-prefix-arg t))
   (if historic
       (call-interactively 'vc-version-diff)
     (vc-maybe-buffer-sync not-urgent)
-    (let ((fileset (vc-deduce-fileset t)))
+    (let ((fileset (or fileset (vc-deduce-fileset t))))
       (vc-buffer-sync-fileset fileset not-urgent)
       (vc-diff-internal t fileset nil nil
                        (called-interactively-p 'interactive)))))



reply via email to

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