]> git.eshelyaron.com Git - emacs.git/commitdiff
'C-c C-d' on vc-log buffer shows the diff from 'vc-log-fileset' (bug#52349)
authorJuri Linkov <juri@linkov.net>
Sun, 28 Aug 2022 19:44:52 +0000 (22:44 +0300)
committerJuri Linkov <juri@linkov.net>
Sun, 28 Aug 2022 19:44:52 +0000 (22:44 +0300)
* 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
lisp/vc/vc-dispatcher.el
lisp/vc/vc.el

index 4a94553b214f82eaa3e4633798b7fb75910541b1..52906163024bd990512ea7ffabec2fde724f6182 100644 (file)
@@ -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)
index df5bf1cfa696f1ec8ac372b5988f60457f9cf018..36a6f27891b07f784a18981198b76f916a1f6642 100644 (file)
@@ -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))
index 88139fe13d8d8312418bc67746e622d3bf365000..d93be951a3c2a4e6b8d89108efddc8b3988a8fd7 100644 (file)
@@ -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)))))