From 8a8b81c1e48a45ca187623f3c45d0c332bcd45ac Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Mon, 9 May 2022 14:06:24 +0200 Subject: [PATCH] Make ediff-show-diff-output work better on unsaved buffers * 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 | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lisp/vc/ediff-util.el b/lisp/vc/ediff-util.el index b41def2aff3..f140f145593 100644 --- a/lisp/vc/ediff-util.el +++ b/lisp/vc/ediff-util.el @@ -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) -- 2.39.2