summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuri Linkov <juri@linkov.net>2022-08-28 22:44:52 +0300
committerJuri Linkov <juri@linkov.net>2022-08-28 22:44:52 +0300
commit78698e9211ce642fb0ddeb63ce7d26339863d557 (patch)
tree23352953bc29bfe0f5458e3cfb6c26d78d52abfe
parent4803fba487d41f0817feab48b5095ef4b4940ff6 (diff)
downloademacs-78698e9211ce642fb0ddeb63ce7d26339863d557.tar.gz
'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.
-rw-r--r--lisp/vc/log-edit.el7
-rw-r--r--lisp/vc/vc-dispatcher.el2
-rw-r--r--lisp/vc/vc.el7
3 files changed, 12 insertions, 4 deletions
diff --git a/lisp/vc/log-edit.el b/lisp/vc/log-edit.el
index 4a94553b214..52906163024 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 df5bf1cfa69..36a6f27891b 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 88139fe13d8..d93be951a3c 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)))))