Diff mode for Alpha.
Name: | Diff Mode |
Version: | 5.0.3 |
Last update: | 2016-07-30 11:53:33 |
Introduction
The Diff mode for Alpha implements powerful side-by-side file comparison,
including the ability to patch differences back and forth between the two
files. Diff mode also copes with context-sensitive diffs (using the -c
option).
Basic usage
- Examine the submenu Tools ↣ Compare. It
contains items to compare windows, selections, files, or directories.
- Use Compare ↣ Windows, Compare ↣ Selections, Compare ↣ FilesÉ, or
Compare ↣ DirectoriesÉ to compare two things.
When comparing windows, the two topmost windows will be compared, the
topmost window being considered the old file. The Compare submenu
is dynamical: holding down the Alt key (
⌥
) gives
two new menu items: Compare ↣ Windows Word By Word and Compare ↣ Selections Word By Word,
which give you more fine-grained differences and ignore changes which
amount to differences in line breaking.
- When a diff has been executed, a diff window is opened and a new Diff
menu is inserted in the menu bar.
- Use the Up and Down arrow keys
to move around and compare the files.
- Use the Control-Left and Control-Right key combos
(
⌃-Left
and ⌃-Right
)
to patch changes from one window to the other.
You can rerun the diff using the Diff Menu ↣ Rerun Diff menu command.
When diffing files in a mark-up language like TeX or HTML, where line
breaks are not themselves significant, it often happens that a big block
of text is flagged as changed, although in reality the paragraph has just
been reflowed. In this situation, you can use the Diff Menu ↣ Refine Diff
menu command, which can also be invoked just by pressing 'r' while the Diff
window is frontmost. This will spawn a separate word-by-word diff on the
two selections, which will pinpoint what actually changed inside the
paragraph. During this subordinate diff run you can patch as usual, and
when you have finished, just close the auxiliary diff window to return to
the overall diff job.
Examples and preferences
Some example files are available: Click on this Compare Example
hyperlink, which compares two versions of a .tcl file found in the Examples
folder. Click on this CompareWordByWord Example hyperlink which compares
two texts word by word.
Inspect the preferences Mode-diff preferences panel for various options that can be set to
control the behavior of performing diff operations.
Which helper application?
The diff mode resorts to a helper application to accomplish the actual
comparison. This takes place in the background. In case of troubles, make
sure your helper applications are configured correctly. To check or change
the configuration select the AlphaCocoa ↣ Global Setup ↣ Helper Applications
menu item and choose a "Diff" helper application.
See the Helper Applications preferences panel.
Alpha is distributed with a helper application called DiffBOA (Diff Background Only Application), which is located inside the Alpha
bundle. A second option is to use diff which is just the unix diff
tool, but beware that this implementation does not work on files with mac
line-endings (CR). It support only the unix line-endings (LF). A third
option is Built-in file comparison. That's Alpha's own pure-Tcl
emulation of diff. It has two shortcomings: it does not diff folders, only
files, and it doesn't respect any preference flags, always using linesOfContext equal to 0.
Advanced usage
Open any .diff file, locate either the left or right file and you
can patch in changes from the diff window using ⌃-Left
or ⌃-Right
as appropriate.
Technical issues and limitations
The main feature which is lacking is an 'unpatch' feature. You will have
to make do with Alpha's 'Undo' facility for the moment. (Basically the
problem is if you patch section 'a', then patch section 'b', you can't undo
'a' without undoing 'b' first).
More detailed documentation on 'diff' can be found at:
http://www.gnu.org/manual/diffutils-2.7/html_chapter/diff_3.html.
Please report any problem or bug you encounter to
Alpha's Bug Tracker.
License and Disclaimer
Copyright (c) 1997-2016, Vince Darley
All rights reserved.
The Diff Mode package is free software and distributed under the terms of the new
BSD license:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
- Neither the name of Vince Darley nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL VINCE DARLEY BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.