GNU bug report logs - #11320
[PATCH 2/2] Useful behavior for ediff-inferior-compare-regions when merging with an ancestor

Previous Next

Package: emacs;

Reported by: Dave Abrahams <dave <at> boostpro.com>

Date: Mon, 23 Apr 2012 19:30:03 UTC

Severity: normal

Tags: fixed, patch

Fixed in version 27.1

Done: Noam Postavsky <npostavs <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Noam Postavsky <npostavs <at> gmail.com>
To: Dave Abrahams <dave <at> boostpro.com>
Cc: 11320 <at> debbugs.gnu.org
Subject: bug#11320: [PATCH 2/2] Useful behavior for ediff-inferior-compare-regions when merging with an ancestor
Date: Fri, 11 May 2018 22:03:04 -0400
[Message part 1 (text/plain, inline)]
Dave Abrahams <dave <at> boostpro.com> writes:

> The default, when "comparing currently-highlighted difference regions"
> was to compare the selected region to the entire conflict in the merge
> buffer.

Right, this is pretty useless.

> -    (if (and (ediff-valid-difference-p ediff-current-difference)
> +    (when (and (ediff-valid-difference-p ediff-current-difference)
>  	     (y-or-n-p "Compare currently highlighted difference regions? "))
> -	(setq use-current-diff-p t))
> +      (setq use-current-diff-p t)
> +      (if ediff-merge-with-ancestor-job
> +          (setq bufB ediff-ancestor-buffer)))

Would it make sense to ask about ancestor vs merge buffer even before
the "currently highlighted" query?  I don't quite see why those two
should be tied together.  Although with the patch below, it might be too
many queries, perhaps it's better to only ask when given a prefix arg or
something.

[0001-Let-ediff-compare-against-ancestor-buffer-Bug-11320.patch (text/x-diff, inline)]
From b503830af00e38ba0d510467dea957e95668a74b Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs <at> gmail.com>
Date: Fri, 11 May 2018 21:56:56 -0400
Subject: [PATCH] Let ediff '=' compare against ancestor buffer (Bug#11320)

* lisp/vc/ediff-util.el (ediff-inferior-compare-regions): Ask user
whether to compare against the ancestor or merge buffer.  Use
read-multiple-choice for A vs B buffer query.
---
 lisp/vc/ediff-util.el | 31 +++++++++++++------------------
 1 file changed, 13 insertions(+), 18 deletions(-)

diff --git a/lisp/vc/ediff-util.el b/lisp/vc/ediff-util.el
index 104a578268..c121df9eca 100644
--- a/lisp/vc/ediff-util.el
+++ b/lisp/vc/ediff-util.el
@@ -3546,25 +3546,20 @@ ediff-inferior-compare-regions
     (ediff-paint-background-regions 'unhighlight)
 
     (cond ((ediff-merge-job)
-	   (setq bufB ediff-buffer-C)
+	   (setq bufB (if (and ediff-ancestor-buffer
+                               (y-or-n-p "Compare against ancestor buffer?"))
+                          ediff-ancestor-buffer
+                        ediff-buffer-C))
 	   ;; ask which buffer to compare to the merge buffer
-	   (while (cond ((eq answer ?A)
-			 (setq bufA ediff-buffer-A
-			       possibilities '(?B))
-			 nil)
-			((eq answer ?B)
-			 (setq bufA ediff-buffer-B
-			       possibilities '(?A))
-			 nil)
-			((equal answer ""))
-			(t (beep 1)
-			   (message "Valid values are A or B")
-			   (sit-for 2)
-			   t))
-	     (let ((cursor-in-echo-area t))
-	       (message
-		"Which buffer to compare to the merge buffer (A or B)? ")
-	       (setq answer (capitalize (read-char-exclusive))))))
+	   (setq answer (car (read-multiple-choice
+                              (format "Which buffer to compare to the %s buffer?"
+                                      (if (eq bufB ediff-ancestor-buffer)
+                                          "ancestor" "merge"))
+                              '((?a "A")
+                                (?b "B")))))
+           (if (eq answer ?a)
+               (setq bufA ediff-buffer-A)
+             (setq bufA ediff-buffer-B)))
 
 	  ((ediff-3way-comparison-job)
 	   ;; ask which two buffers to compare
-- 
2.11.0


This bug report was last modified 7 years and 19 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.