emacs-diffs
[Top][All Lists]
Advanced

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

master 15d2f6a: Tweak the `C-x v =' command when done from a diff buffer


From: Lars Ingebrigtsen
Subject: master 15d2f6a: Tweak the `C-x v =' command when done from a diff buffer
Date: Mon, 14 Sep 2020 09:43:16 -0400 (EDT)

branch: master
commit 15d2f6af000625640b3c47d2aeec3114ac1ac544
Author: Kevin Ryde <user42@zip.com.au>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Tweak the `C-x v =' command when done from a diff buffer
    
    * lisp/vc/vc.el (vc-diff): Offer to save the relevant buffer(s)
    when doing `C-x v =' from a diff buffer (bug#5773).
---
 lisp/vc/vc.el | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
index 4cbd265..3852a64 100644
--- a/lisp/vc/vc.el
+++ b/lisp/vc/vc.el
@@ -1895,9 +1895,16 @@ saving the buffer."
   (interactive (list current-prefix-arg t))
   (if historic
       (call-interactively 'vc-version-diff)
-    (when buffer-file-name (vc-buffer-sync not-urgent))
-    (vc-diff-internal t (vc-deduce-fileset t) nil nil
-                     (called-interactively-p 'interactive))))
+    (let ((fileset (vc-deduce-fileset t)))
+      (vc-buffer-sync-fileset fileset not-urgent)
+      (vc-diff-internal t fileset nil nil
+                       (called-interactively-p 'interactive)))))
+
+(defun vc-buffer-sync-fileset (fileset not-urgent)
+  (dolist (filename (cadr fileset))
+    (when-let ((buffer (find-buffer-visiting filename)))
+      (with-current-buffer buffer
+       (vc-buffer-sync not-urgent)))))
 
 ;;;###autoload
 (defun vc-diff-mergebase (_files rev1 rev2)



reply via email to

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