Search                        Top                                  Index
HELP CDIFF                                            A. Sloman Dec 1985
HELP NEXTCSAME                                          Revised Jan 1995

These two autoloadable libraries facilitate comparing two files while
ignoring irrelevant differences, e.g. extra "white space".


 -- Introduction
 -- <ENTER> cdiff
 -- <ENTER> nextcsame
 -- <ENTER> nextcsame N
 -- Case Conversion
 -- Altering what counts as white space
 -- See also HELP * DIFF.

-- Introduction -------------------------------------------------------
<ENTER> cdiff
<ENTER> nextcsame

    Compare files ignoring "white" space, or equivalent. This makes it
    easy to compare a formatted and an unformatted file, or files with and
    without tabs. It also makes it easy to compare two versions of the same
    file, where one has been re-formatted, e.g. by changing lengths of
    lines. The commands can be alternated using the REDO key in VED,
    i.e. first find the next difference, then find the next similar
    stretch in the two files, then the next difference, etc.

-- <ENTER> cdiff
This command causes VED to compare the current file and the next file
in vedbufferlist, character by character, starting at current location
in each file, but ignoring all space characters. Space characters are
defined by being characters in the string ved_cdiff_ignore, whose
definition defaults to

        '\s\t\n\r\St\Sp\Sn' -> ved_cdiff_ignore;

spaces, tabs and newlines. Users may change this, e.g. adding
punctuation marks to be ignored.

See REF * VEDPROCS/'Special Spaces' REF * ITEMISE/'Ved Special Space'

If ved_ignore_case is true, then upper and lower case versions of the
same letter are treated as equivalent, e.g. as in 'Cat' and 'cAt'.

If there is no difference in characters in the two files, between the
two start points and the end of file, then a message to this effect will
be put on the status line, and the cursor returns to original location
in both files.

If there is a difference then the cursor moves to first character after
locations which differ, in each file. <ESC> x can be used to see how far
it has got in the 'other' file.

In addition, the command 'nextcsame' is made the current command, so
that by pressing the REDO key you can make VED search for the next
location where the two files are the same.

-- <ENTER> nextcsame
This command is provided for use in conjunction with ved_cdiff. It
searches down at most ved_nextcsame_lines (default 6) lines in each
file, looking for lines that contain at least ved_min_char_match
(default 15) matching non-space characters, where non-space characters
are defined by the string ved_cdiff_ignore, as defined above.

Where a file tends to have short lines, the value of ved_min_char_match
should be reduced.

It is quite hard to prevent ved_nextcsame finding a spurious match. e.g.
in a Pop-11 program file it may easily find two occurrences of endunless
which have nothing to do with each other. In some cases it will be
necessary first to reposition the cursor in one or both files.

Once it files two strings that are the same it stops, and makes 'cdiff'
the next command, so that pressing the REDO button will make it search
for the next difference.

-- <ENTER> nextcsame N
    If given an integer argument N, N is assigned to ved_nextcsame_lines
    e.g. to require ved_nextcsame to look further afield for a match.

-- Case Conversion ----------------------------------------------------

Case differences will be ignored by ved_cdiff if you do:

    true -> ved_ignore_case

The default value is FALSE.

-- Altering what counts as white space --------------------------------

The variable VED_CDIFF_IGNORE holds a string of characters to treat as
white space. The default is:

    '\s\t\n\r\St\Sp\Sn' -> ved_cdiff_ignore;

If you wish commas, fullstops, etc. to be treated like white space,
do something like:

    '\s\t\n\r\St\Sp\Sn.,;:' -> ved_cdiff_ignore;

Probably CDIFF should allow an optional argument saying which characters
should count as white space.

-- See also HELP * DIFF.

<ENTER> diff compares files a line at a time until it finds lines which
differ. It is substantially faster.

--- $poplocal/local/help/cdiff
--- Copyright University of Birmingham 1996. All rights reserved. ------