bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#11319: [PATCH 1/2] BUGFIX: select current-diff-comparison regions fo


From: Dave Abrahams
Subject: bug#11319: [PATCH 1/2] BUGFIX: select current-diff-comparison regions for ediff-inferior-compare-regions correctly
Date: Mon, 23 Apr 2012 15:28:25 -0400

The buffer types passed to
ediff-clone-buffer-for-current-diff-comparison are used to select the
character ranges that participate in the inferior comparison.  Those
were being hardcoded as 'A and 'B, which was wrong.
---
 lisp/vc/ediff-util.el |   20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/lisp/vc/ediff-util.el b/lisp/vc/ediff-util.el
index 78a2163..046070d 100644
--- a/lisp/vc/ediff-util.el
+++ b/lisp/vc/ediff-util.el
@@ -3378,10 +3378,18 @@ Without an argument, it saves customized diff argument, 
if available
     (set-window-buffer wind cloned-buff)
     cloned-buff))
 
-(defun ediff-clone-buffer-for-current-diff-comparison (buff buf-type reg-name)
-  (let ((cloned-buff (ediff-make-cloned-buffer buff reg-name))
-       (reg-start (ediff-get-diff-posn buf-type 'beg))
-       (reg-end (ediff-get-diff-posn buf-type 'end)))
+(defun ediff-buffer-type (buffer)
+  (cond ((eq buffer ediff-buffer-A) 'A)
+        ((eq buffer ediff-buffer-B) 'B)
+        ((eq buffer ediff-buffer-C) 'C)
+        ((eq buffer ediff-ancestor-buffer) 'Ancestor)
+        (t nil)))
+
+(defun ediff-clone-buffer-for-current-diff-comparison (buff reg-name)
+  (let* ((cloned-buff (ediff-make-cloned-buffer buff reg-name))
+         (buf-type (ediff-buffer-type buff))
+         (reg-start (ediff-get-diff-posn buf-type 'beg))
+         (reg-end (ediff-get-diff-posn buf-type 'end)))
     (ediff-with-current-buffer cloned-buff
       ;; set region to be the current diff region
       (goto-char reg-start)
@@ -3555,7 +3563,7 @@ Ediff Control Panel to restore highlighting."
 
     (setq bufA (if use-current-diff-p
                   (ediff-clone-buffer-for-current-diff-comparison
-                   bufA 'A "-Region.A-")
+                   bufA "-Region.A-")
                 (ediff-clone-buffer-for-region-comparison bufA "-Region.A-")))
     (ediff-with-current-buffer bufA
       (setq begA (region-beginning)
@@ -3570,7 +3578,7 @@ Ediff Control Panel to restore highlighting."
 
     (setq bufB (if use-current-diff-p
                   (ediff-clone-buffer-for-current-diff-comparison
-                   bufB 'B "-Region.B-")
+                   bufB "-Region.B-")
                 (ediff-clone-buffer-for-region-comparison bufB "-Region.B-")))
     (ediff-with-current-buffer bufB
       (setq begB (region-beginning)
-- 
1.7.10






reply via email to

[Prev in Thread] Current Thread [Next in Thread]