From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.devel Subject: Re: compare-windows - synchronize points Date: 20 Aug 2003 08:56:07 +0300 Organization: JURTA Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <87zni4dg94.fsf@mail.jurta.org> References: <87adagx8x8.fsf@mail.jurta.org> <87oeyuuuvz.fsf@mail.jurta.org> <87ptj8ajmx.fsf@mail.jurta.org> <87wudamyxb.fsf@mail.jurta.org> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1061543613 14722 80.91.224.253 (22 Aug 2003 09:13:33 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 22 Aug 2003 09:13:33 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Fri Aug 22 11:13:31 2003 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 19q7z9-0007Do-00 for ; Fri, 22 Aug 2003 11:13:31 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 19q83G-0006AM-00 for ; Fri, 22 Aug 2003 11:17:46 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.20) id 19q7dM-0008Ib-LA for emacs-devel@quimby.gnus.org; Fri, 22 Aug 2003 04:51:00 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.20) id 19q1PA-0002Td-Sk for emacs-devel@gnu.org; Thu, 21 Aug 2003 22:11:56 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.20) id 19q0U1-0001v8-PA for emacs-devel@gnu.org; Thu, 21 Aug 2003 21:13:25 -0400 Original-Received: from [64.246.52.22] (helo=ns5.tangramltd.com) by monty-python.gnu.org with esmtp (Exim 4.20) id 19pMAY-0002Zl-1P; Wed, 20 Aug 2003 02:10:06 -0400 Original-Received: from 80-235-41-177-dsl.mus.estpak.ee ([80.235.41.177] helo=thinkpad.jurta.org) by ns5.tangramltd.com with esmtp (Exim 4.20) id 19pMAT-00044V-Uv; Wed, 20 Aug 2003 09:10:02 +0300 Original-To: rms@gnu.org In-Reply-To: User-Agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3.50 (gnu/linux) Original-Lines: 43 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - ns5.tangramltd.com X-AntiAbuse: Original Domain - gnu.org X-AntiAbuse: Originator/Caller UID/GID - [0 0] / [47 12] X-AntiAbuse: Sender Address Domain - jurta.org X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Emacs development discussions. List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:16059 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:16059 > The small number makes the difference regions more fine-grained, > but often it fails by finding the wrong match (the same string which > is closer to the starting point). > > I don't follow that. Could you explain it with an example? > When I understand the problem, maybe I can propose a solution. I forgot to mention that with small number it fails when an insertion contains the same substring which follows after an insertion. In this case it finds the closest substring (in inserted text) instead of original text unchanged in both files. Here is an example: suppose that original file contains following lines: (defvar a nil) (defvar b nil) (defvar c nil) (defvar d nil) and a new line "(defvar x nil)" was added between defvars "a" and "b": (defvar a nil) (defvar x nil) (defvar b nil) (defvar c nil) (defvar d nil) Now, if compare-windows-sync-string-size is 4 (or even 8), then after matching the first 23 characters (until character "b" in first file and "x" in second) it will find that difference regions are "b" and "x". It's because it gets the substring with size 8: " nil)\n(d" and finds its closest occurrence just after both "b" and "x". And after that it completely goes out of sync, claiming that "c" was replaced by "b", "d" by "c", and so on. If compare-windows-sync-string-size is larger (e.g. 16), then it looks for a larger substring " nil)\n(defvar c ", which includes the next variable name "c", and it finds the correct match. -- http://www.jurta.org/emacs/