[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#11320: [PATCH 2/2] Useful behavior for ediff-inferior-compare-region
From: |
Noam Postavsky |
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 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) |
Dave Abrahams <dave@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.
>From b503830af00e38ba0d510467dea957e95668a74b Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs@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
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- bug#11320: [PATCH 2/2] Useful behavior for ediff-inferior-compare-regions when merging with an ancestor,
Noam Postavsky <=