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).
This commit is contained in:
Kevin Ryde 2020-09-14 15:40:07 +02:00 committed by Lars Ingebrigtsen
parent 312da48719
commit 15d2f6af00

View file

@ -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)