]> git.eshelyaron.com Git - emacs.git/commitdiff
Make ediff-show-diff-output work better on unsaved buffers
authorLars Ingebrigtsen <larsi@gnus.org>
Mon, 9 May 2022 12:06:24 +0000 (14:06 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Mon, 9 May 2022 12:06:39 +0000 (14:06 +0200)
* lisp/vc/ediff-util.el (ediff-show-diff-output): Make the `D'
command work on unsaved buffers without a prefix (bug#45016).

lisp/vc/ediff-util.el

index b41def2aff3fc77dd27a586b85daee6d084af9c8..f140f145593d073c5f6c000ec8f76b3e28e189cc 100644 (file)
@@ -3431,6 +3431,9 @@ Without an argument, it saves customized diff argument, if available
     ))
 
 (defun ediff-show-diff-output (arg)
+  "With prefix argument ARG, show plain diff output.
+Without an argument, it saves customized diff argument, if available
+(and plain output, if customized output was not generated)."
   (interactive "P")
   (ediff-barf-if-not-control-buffer)
   (ediff-compute-custom-diffs-maybe)
@@ -3438,7 +3441,10 @@ Without an argument, it saves customized diff argument, if available
     (ediff-skip-unsuitable-frames ' ok-unsplittable))
   (let ((buf (cond ((and arg (ediff-buffer-live-p ediff-diff-buffer))
                    ediff-diff-buffer)
-                  ((ediff-buffer-live-p ediff-custom-diff-buffer)
+                  ((and (ediff-buffer-live-p ediff-custom-diff-buffer)
+                         ;; We may not have gotten a custom output if
+                         ;; we're working on unsaved buffers.
+                         (> (buffer-size ediff-custom-diff-buffer) 0))
                    ediff-custom-diff-buffer)
                   ((ediff-buffer-live-p ediff-diff-buffer)
                    ediff-diff-buffer)