From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kevin Rodgers Newsgroups: gmane.emacs.bugs Subject: ediff-regions-internal can't handle (non-overlapping) regions in the same buffer Date: Wed, 07 Dec 2005 13:59:31 -0700 Message-ID: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1133989711 22476 80.91.229.2 (7 Dec 2005 21:08:31 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 7 Dec 2005 21:08:31 +0000 (UTC) Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Dec 07 22:08:29 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1Ek6U4-0002PP-Ns for geb-bug-gnu-emacs@m.gmane.org; Wed, 07 Dec 2005 22:05:53 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ek6UK-0008S1-CF for geb-bug-gnu-emacs@m.gmane.org; Wed, 07 Dec 2005 16:06:08 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Ek6UI-0008RE-Ph for bug-gnu-emacs@gnu.org; Wed, 07 Dec 2005 16:06:06 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Ek6UH-0008R2-8A for bug-gnu-emacs@gnu.org; Wed, 07 Dec 2005 16:06:06 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ek6UG-0008Qy-Vw for bug-gnu-emacs@gnu.org; Wed, 07 Dec 2005 16:06:05 -0500 Original-Received: from [80.91.229.2] (helo=ciao.gmane.org) by monty-python.gnu.org with esmtp (TLS-1.0:RSA_AES_128_CBC_SHA:16) (Exim 4.34) id 1Ek6VA-0005Jc-OG for bug-gnu-emacs@gnu.org; Wed, 07 Dec 2005 16:07:01 -0500 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1Ek6SB-0001kH-Jk for bug-gnu-emacs@gnu.org; Wed, 07 Dec 2005 22:03:55 +0100 Original-Received: from 207.167.42.60 ([207.167.42.60]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 07 Dec 2005 22:03:55 +0100 Original-Received: from ihs_4664 by 207.167.42.60 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 07 Dec 2005 22:03:55 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-To: bug-gnu-emacs@gnu.org Original-Lines: 59 Original-X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: 207.167.42.60 User-Agent: Mozilla Thunderbird 0.9 (X11/20041105) X-Accept-Language: en-us, en X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:14529 Archived-At: I'm working on a way to take advantage of Ediff's fine highlighting feature within Diff mode buffers. But calling ediff-regions-internal programmatically with BUFFER-A the same as BUFFER-B doesn't work, leaving only the region between BEG-B and END-B highighted. This is because ediff-extract-diffs first resets point in both buffers (changing point in BUFFER-A unintentionally), then builds the diff vector by moving by lines in each buffer. The fix is simple, and it allows ediff-regions-internal to work with non-overlapping regions in the same buffer: Don't set point in each buffer until necessary: *** emacs-21.4/lisp/ediff-diff.el~ Wed Jul 3 10:49:40 2002 --- emacs-21.4/lisp/ediff-diff.el Wed Dec 7 13:34:26 2005 *************** *** 378,388 **** (ediff-overlay-start (ediff-get-value-according-to-buffer-type 'B bounds)))) ! ;; reset point in buffers A/B/C ! (ediff-with-current-buffer A-buffer ! (goto-char (if shift-A shift-A (point-min)))) ! (ediff-with-current-buffer B-buffer ! (goto-char (if shift-B shift-B (point-min)))) (if (ediff-buffer-live-p C-buffer) (ediff-with-current-buffer C-buffer (goto-char (point-min)))) --- 378,384 ---- (ediff-overlay-start (ediff-get-value-according-to-buffer-type 'B bounds)))) ! ;; reset point in buffer C (if (ediff-buffer-live-p C-buffer) (ediff-with-current-buffer C-buffer (goto-char (point-min)))) *************** *** 456,461 **** --- 452,458 ---- c-prev c-end) ;; else convert lines to points (ediff-with-current-buffer A-buffer + (goto-char (if shift-A shift-A (point-min))) (forward-line (- a-begin a-prev)) (setq a-begin-pt (point)) (forward-line (- a-end a-begin)) *************** *** 462,467 **** --- 459,465 ---- (setq a-end-pt (point) a-prev a-end)) (ediff-with-current-buffer B-buffer + (goto-char (if shift-B shift-B (point-min))) (forward-line (- b-begin b-prev)) (setq b-begin-pt (point)) (forward-line (- b-end b-begin)) Thanks, -- Kevin