[Top][All Lists]

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

Re: compare-windows - synchronize points

From: Juri Linkov
Subject: Re: compare-windows - synchronize points
Date: 20 Aug 2003 08:56:07 +0300
User-agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3.50 (gnu/linux)

>     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.


reply via email to

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