root/branches/2.1/info/ediff-2

Revision 3212, 49.1 kB (checked in by miyoshi, 5 years ago)

Sync up with Emacs-21.3.

Line 
1 This is ../info/ediff, produced by makeinfo version 4.2 from ediff.texi.
2
3 INFO-DIR-SECTION Emacs
4 START-INFO-DIR-ENTRY
5 * Ediff: (ediff).       A visual interface for comparing and merging programs.
6 END-INFO-DIR-ENTRY
7
8    This file documents Ediff, a comprehensive visual interface to diff
9 and patch utilities.
10
11    Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001 Free Software
12 Foundation, Inc.
13
14    Permission is granted to copy, distribute and/or modify this document
15 under the terms of the GNU Free Documentation License, Version 1.1 or
16 any later version published by the Free Software Foundation; with no
17 Invariant Sections, with the Front-Cover texts being "A GNU Manual",
18 and with the Back-Cover Texts as in (a) below.  A copy of the license
19 is included in the section entitled "GNU Free Documentation License" in
20 the Emacs manual.
21
22    (a) The FSF's Back-Cover Text is: "You have freedom to copy and
23 modify this GNU Manual, like GNU software.  Copies published by the Free
24 Software Foundation raise funds for GNU development."
25
26    This document is part of a collection distributed under the GNU Free
27 Documentation License.  If you want to distribute this document
28 separately from the collection, you can do so by adding a copy of the
29 license to the document, as described in section 6 of the license.
30
31 
32 File: ediff,  Node: Quick Help Customization,  Next: Window and Frame Configuration,  Prev: Hooks,  Up: Customization
33
34 Quick Help Customization
35 ========================
36
37    Ediff provides quick help using its control panel window.  Since
38 this window takes a fair share of the screen real estate, you can
39 toggle it off by typing `?'.  The control window will then shrink to
40 just one line and a mode line, displaying a short help message.
41
42    The variable `ediff-use-long-help-message' tells Ediff whether you
43 use the short message or the long one.  By default, it is set to `nil',
44 meaning that the short message is used.  Set this to `t', if you want
45 Ediff to use the long message by default.  This property can always be
46 changed interactively, by typing `?' into Ediff Control Buffer.
47
48    If you want to change the appearance of the help message on a
49 per-buffer basis, you must use `ediff-startup-hook' to change the value
50 of the variable `ediff-help-message', which is local to
51 `ediff-control-buffer'.
52
53 
54 File: ediff,  Node: Window and Frame Configuration,  Next: Selective Browsing,  Prev: Quick Help Customization,  Up: Customization
55
56 Window and Frame Configuration
57 ==============================
58
59    On a non-windowing display, Ediff sets things up in one frame,
60 splitting it between a small control window and the windows for buffers
61 A, B, and C.  The split between these windows can be horizontal or
62 vertical, which can be changed interactively by typing `|' while the
63 cursor is in the control window.
64
65    On a window display, Ediff sets up a dedicated frame for Ediff
66 Control Panel and then it chooses windows as follows: If one of the
67 buffers is invisible, it is displayed in the currently selected frame.
68 If a buffer is visible, it is displayed in the frame where it is
69 visible.  If, according to the above criteria, the two buffers fall
70 into the same frame, then so be it--the frame will be shared by the
71 two.  The same algorithm works when you type `C-l' (`ediff-recenter'),
72 `p' (`ediff-previous-difference'), `n' (`ediff-next-difference'), etc.
73
74    The above behavior also depends on whether the current frame is
75 splittable, dedicated, etc.  Unfortunately, the margin of this book is
76 too narrow to present the details of this remarkable algorithm.
77
78    The upshot of all this is that you can compare buffers in one frame
79 or in different frames.  The former is done by default, while the
80 latter can be achieved by arranging buffers A, B (and C, if applicable)
81 to be seen in different frames.  Ediff respects these arrangements,
82 automatically adapting itself to the multi-frame mode.
83
84    Ediff uses the following variables to set up its control panel
85 (a.k.a. control buffer, a.k.a. quick help window):
86
87 `ediff-control-frame-parameters'
88      You can change or augment this variable including the font, color,
89      etc.  The X resource name of Ediff Control Panel frames is
90      `Ediff'.  Under X-windows, you can use this name to set up
91      preferences in your `~/.Xdefaults', `~/.xrdb', or whatever X
92      resource file is in use.  Usually this is preferable to changing
93      `ediff-control-frame-parameters' directly.  For instance, you can
94      specify in `~/.Xdefaults' the color of the control frame using the
95      resource `Ediff*background'.
96
97      In general, any X resource pertaining the control frame can be
98      reached via the prefix `Ediff*'.
99
100 `ediff-control-frame-position-function'
101      The preferred way of specifying the position of the control frame
102      is by setting the variable `ediff-control-frame-position-function'
103      to an appropriate function.  The default value of this variable is
104      `ediff-make-frame-position'.  This function places the control
105      frame in the vicinity of the North-East corner of the frame
106      displaying buffer A.
107
108    The following variables can be used to adjust the location produced
109 by `ediff-make-frame-position' and for related customization.
110
111 `ediff-narrow-control-frame-leftward-shift'
112      Specifies the number of characters for shifting the control frame
113      from the rightmost edge of frame A when the control frame is
114      displayed as a small window.
115
116 `ediff-wide-control-frame-rightward-shift'
117      Specifies the rightward shift of the control frame from the left
118      edge of frame A when the control frame shows the full menu of
119      options.
120
121 `ediff-control-frame-upward-shift'
122      Specifies the number of pixels for the upward shift of the control
123      frame.
124
125 `ediff-prefer-iconified-control-frame'
126      If this variable is `t', the control frame becomes iconified
127      automatically when you toggle the quick help message off.  This
128      saves valuable real estate on the screen.  Toggling help back will
129      deiconify the control frame.
130
131      To start Ediff with an iconified Control Panel, you should set this
132      variable to `t' and `ediff-prefer-long-help-message' to `nil'
133      (*note Quick Help Customization::).  This behavior is useful only
134      if icons are allowed to accept keybord input (which depend on the
135      window manager and other factors).
136
137    To make more creative changes in the way Ediff sets up windows, you
138 can rewrite the function `ediff-setup-windows'.  However, we believe
139 that detaching Ediff Control Panel from the rest and making it into a
140 separate frame offers an important opportunity by allowing you to
141 iconify that frame.  The icon will usually accept all of the Ediff
142 commands, but will free up valuable real estate on your screen (this may
143 depend on your window manager, though).
144
145    The following variable controls how windows are set up:
146
147 `ediff-window-setup-function'
148      The multiframe setup is done by the
149      `ediff-setup-windows-multiframe' function, which is the default on
150      windowing displays.  The plain setup, one where all windows are
151      always in one frame, is done by `ediff-setup-windows-plain', which
152      is the default on a non-windowing display (or in an xterm window).
153      In fact, under Emacs, you can switch freely between these two
154      setups by executing the command `ediff-toggle-multiframe' using
155      the Minibuffer of the Menubar.
156
157      If you don't like any of these setups, write your own function.
158      See the documentation for `ediff-window-setup-function' for the
159      basic guidelines.  However, writing window setups is not easy, so
160      you should first take a close look at `ediff-setup-windows-plain'
161      and `ediff-setup-windows-multiframe'.
162
163    You can run multiple Ediff sessions at once, by invoking Ediff
164 several times without exiting previous Ediff sessions.  Different
165 sessions may even operate on the same pair of files.
166
167    Each session has its own Ediff Control Panel and all the regarding a
168 particular session is local to the associated control panel buffer.  You
169 can switch between sessions by suspending one session and then switching
170 to another control panel.  (Different control panel buffers are
171 distinguished by a numerical suffix, e.g., `Ediff Control Panel<3>'.)
172
173 
174 File: ediff,  Node: Selective Browsing,  Next: Highlighting Difference Regions,  Prev: Window and Frame Configuration,  Up: Customization
175
176 Selective Browsing
177 ==================
178
179    Sometimes it is convenient to be able to step through only some
180 difference regions, those that match certain regular expressions, and
181 to ignore all others.  On other occasions, you may want to ignore
182 difference regions that match some regular expressions, and to look
183 only at the rest.
184
185    The commands `#f' and `#h' let you do precisely this.
186
187    Typing `#f' lets you specify regular expressions that match
188 difference regions you want to focus on.  We shall call these regular
189 expressions REGEXP-A, REGEXP-B and REGEXP-C.  Ediff will then start
190 stepping through only those difference regions where the region in
191 buffer A matches REGEXP-A and/or the region in buffer B matches
192 REGEXP-B, etc.  Whether `and' or `or' will be used depends on how you
193 respond to a question.
194
195    When scanning difference regions for the aforesaid regular
196 expressions, Ediff narrows the buffers to those regions.  This means
197 that you can use the expressions `\`' and `\'' to tie search to the
198 beginning or end of the difference regions.
199
200    On the other hand, typing `#h' lets you specify (hide) uninteresting
201 regions.  That is, if a difference region in buffer A matches REGEXP-A,
202 the corresponding region in buffer B matches REGEXP-B and (if
203 applicable) buffer C's region matches REGEXP-C, then the region will be
204 ignored by the commands `n'/<SPC> (`ediff-next-difference') and
205 `p'/<DEL> (`ediff-previous-difference') commands.
206
207    Typing `#f' and `#h' toggles selective browsing on and off.
208
209    Note that selective browsing affects only `ediff-next-difference'
210 and `ediff-previous-difference', i.e., the commands `n'/<SPC> and
211 `p'/<DEL>.  `#f' and `#h' do not change the position of the point in
212 the buffers.  And you can still jump directly (using `j')  to any
213 numbered difference.
214
215    Users can supply their own functions to specify how Ediff should do
216 selective browsing.  To change the default Ediff function, add a
217 function to `ediff-load-hook' which will do the following assignments:
218
219      (setq ediff-hide-regexp-matches-function 'your-hide-function)
220      (setq ediff-focus-on-regexp-matches-function 'your-focus-function)
221
222    *Useful hint*: To specify a regexp that matches everything, don't
223 simply type <RET> in response to a prompt.  Typing <RET> tells Ediff to
224 accept the default value, which may not be what you want.  Instead, you
225 should enter something like <^> or <$>.  These match every line.
226
227    You can use the status command, `i', to find out whether selective
228 browsing is currently in effect.
229
230    The regular expressions you specified are kept in the local variables
231 `ediff-regexp-focus-A', `ediff-regexp-focus-B', `ediff-regexp-focus-C',
232 `ediff-regexp-hide-A', `ediff-regexp-hide-B', `ediff-regexp-hide-C'.
233 Their default value is the empty string (i.e., nothing is hidden or
234 focused on).  To change the default, set these variables in `.emacs'
235 using `setq-default'.
236
237    In addition to the ability to ignore regions that match regular
238 expressions, Ediff can be ordered to start skipping over certain
239 "uninteresting" difference regions.  This is controlled by the following
240 variable:
241
242 `ediff-ignore-similar-regions'
243      If `t', causes Ediff to skip over "uninteresting" difference
244      regions, which are the regions where the variants differ only in
245      the amount of the white space and newlines.  This feature can be
246      toggled on/off interactively, via the command `##'.
247
248    *Note:* In order for this feature to work, auto-refining of
249 difference regions must be on, since otherwise Ediff won't know if there
250 are fine differences between regions.  On devices where Emacs can
251 display faces, auto-refining is a default, but it is not turned on by
252 default on text-only terminals.  In that case, you must explicitly turn
253 auto-refining on (such as, by typing `@').
254
255    *Reassurance:* If many such uninteresting regions appear in a row,
256 Ediff may take a long time to skip over them because it has to compute
257 fine differences of all intermediate regions.  This delay does not
258 indicate any problem.
259
260 
261 File: ediff,  Node: Highlighting Difference Regions,  Next: Narrowing,  Prev: Selective Browsing,  Up: Customization
262
263 Highlighting Difference Regions
264 ===============================
265
266    The following variables control the way Ediff highlights difference
267 regions:
268
269 `ediff-before-flag-bol'
270 `ediff-after-flag-eol'
271 `ediff-before-flag-mol'
272 `ediff-after-flag-mol'
273      These variables hold strings that Ediff uses to mark the beginning
274      and the end of the differences found in files A, B, and C on
275      devices where Emacs cannot display faces.  Ediff uses different
276      flags to highlight regions that begin/end at the beginning/end of
277      a line or in a middle of a line.
278
279 `ediff-current-diff-face-A'
280 `ediff-current-diff-face-B'
281 `ediff-current-diff-face-C'
282      Ediff uses these faces to highlight current differences on devices
283      where Emacs can display faces.  These and subsequently described
284      faces can be set either in `.emacs' or in `.Xdefaults'.  The X
285      resource for Ediff is `Ediff', _not_ `emacs'.  Please refer to
286      Emacs manual for the information on how to set X resources.
287
288 `ediff-fine-diff-face-A'
289 `ediff-fine-diff-face-B'
290 `ediff-fine-diff-face-C'
291      Ediff uses these faces to show the fine differences between the
292      current differences regions in buffers A, B, and C, respectively.
293
294 `ediff-even-diff-face-A'
295 `ediff-even-diff-face-B'
296 `ediff-even-diff-face-C'
297 `ediff-odd-diff-face-A'
298 `ediff-odd-diff-face-B'
299 `ediff-odd-diff-face-C'
300      Non-current difference regions are displayed using these
301      alternating faces.  The odd and the even faces are actually
302      identical on monochrome displays, because without colors options
303      are limited.  So, Ediff uses italics to highlight non-current
304      differences.
305
306 `ediff-force-faces'
307      Ediff generally can detect when Emacs is running on a device where
308      it can use highlighting with faces.  However, if it fails to
309      determine that faces can be used, the user can set this variable
310      to `t' to make sure that Ediff uses faces to highlight differences.
311
312 `ediff-highlight-all-diffs'
313      Indicates whether--on a windowind display--Ediff should highlight
314      differences using inserted strings (as on text-only terminals) or
315      using colors and highlighting.  Normally, Ediff highlights all
316      differences, but the selected difference is highlighted more
317      visibly.  One can cycle through various modes of highlighting by
318      typing `h'.  By default, Ediff starts in the mode where all
319      difference regions are highlighted.  If you prefer to start in the
320      mode where unselected differences are not highlighted, you should
321      set `ediff-highlight-all-diffs' to `nil'.  Type `h' to restore
322      highlighting for all differences.
323
324      Ediff lets you switch between the two modes of highlighting.  That
325      is, you can switch interactively from highlighting using faces to
326      highlighting using string flags, and back.  Of course, switching
327      has effect only under a windowing system.  On a text-only terminal
328      or in an xterm window, the only available option is highlighting
329      with strings.
330
331 If you want to change the default settings for `ediff-force-faces' and
332 `ediff-highlight-all-diffs', you must do it *before* Ediff is loaded.
333
334    You can also change the defaults for the faces used to highlight the
335 difference regions.  There are two ways to do this.  The simplest and
336 the preferred way is to use the customization widget accessible from the
337 menubar.  Ediff's customization group is located under "Tools", which in
338 turn is under "Programming".  The faces that are used to highlight
339 difference regions are located in the "Highlighting" subgroup of the
340 Ediff customization group.
341
342    The second, much more arcane, method to change default faces is to
343 include some Lisp code in `~/.emacs'.  For instance,
344
345      (setq ediff-current-diff-face-A
346            (copy-face 'bold-italic 'ediff-current-diff-face-A))
347
348 would use the pre-defined fase `bold-italic' to highlight the current
349 difference region in buffer A (this face is not a good choice, by the
350 way).
351
352    If you are unhappy with just _some_ of the aspects of the default
353 faces, you can modify them when Ediff is being loaded using
354 `ediff-load-hook'.  For instance:
355
356      (add-hook 'ediff-load-hook
357                (lambda ()
358                  (set-face-foreground
359                    ediff-current-diff-face-B "blue")
360                  (set-face-background
361                    ediff-current-diff-face-B "red")
362                  (make-face-italic
363                    ediff-current-diff-face-B)))
364
365    *Note:* To set Ediff's faces, use only `copy-face' or
366 `set/make-face-...' as shown above. Emacs' low-level face-manipulation
367 functions should be avoided.
368
369 
370 File: ediff,  Node: Narrowing,  Next: Refinement of Difference Regions,  Prev: Highlighting Difference Regions,  Up: Customization
371
372 Narrowing
373 =========
374
375    If buffers being compared are narrowed at the time of invocation of
376 Ediff, `ediff-buffers' will preserve the narrowing range.  However, if
377 `ediff-files' is invoked on the files visited by these buffers, that
378 would widen the buffers, since this command is defined to compare the
379 entire files.
380
381    Calling `ediff-regions-linewise' or `ediff-windows-linewise', or the
382 corresponding `-wordwise' commands, narrows the variants to the
383 particular regions being compared.  The original accessible ranges are
384 restored when you quit Ediff.  During the command, you can toggle this
385 narrowing on and off with the `%' command.
386
387    These two variables control this narrowing behavior:
388
389 `ediff-start-narrowed'
390      If `t', Ediff narrows the display to the appropriate range when it
391      is invoked with an `ediff-regions...' or `ediff-windows...'
392      command.  If `nil', these commands do not automatically narrow,
393      but you can still toggle narrowing on and off by typing `%'.
394
395 `ediff-quit-widened'
396      Controls whether on quitting Ediff should restore the accessible
397      range that existed before the current invocation.
398
399 
400 File: ediff,  Node: Refinement of Difference Regions,  Next: Patch and Diff Programs,  Prev: Narrowing,  Up: Customization
401
402 Refinement of Difference Regions
403 ================================
404
405    Ediff has variables to control the way fine differences are
406 highlighted.  This feature gives you control over the process of
407 refinement.  Note that refinement ignores spaces, tabs, and newlines.
408
409 `ediff-auto-refine'
410      This variable controls whether fine differences within regions are
411      highlighted automatically ("auto-refining").  The default is yes
412      (`on').
413
414      On a slow machine, automatic refinement may be painful.  In that
415      case, you can turn auto-refining on or off interactively by typing
416      `@'.  You can also turn off display of refining that has already
417      been done.
418
419      When auto-refining is off, fine differences are shown only for
420      regions for which these differences have been computed and saved
421      before.  If auto-refining and display of refining are both turned
422      off, fine differences are not shown at all.
423
424      Typing `*' computes and displays fine differences for the current
425      difference region, regardless of whether auto-refining is turned
426      on.
427
428 `ediff-auto-refine-limit'
429      If auto-refining is on, this variable limits the size of the
430      regions to be auto-refined.  This guards against the possible
431      slowdown that may be caused by extraordinary large difference
432      regions.
433
434      You can always refine the current region by typing `*'.
435
436 `ediff-forward-word-function'
437      This variable controls how fine differences are computed.  The
438      value must be a Lisp function that determines how the current
439      difference region should be split into words.
440
441      Fine differences are computed by first splitting the current
442      difference region into words and then passing the result to
443      `ediff-diff-program'.  For the default forward word function
444      (which is `ediff-forward-word'), a word is a string consisting of
445      letters, `-', or `_'; a string of punctuation symbols; a string of
446      digits, or a string consisting of symbols that are neither space,
447      nor a letter.
448
449      This default behavior is controlled by four variables:
450      `ediff-word-1', ..., `ediff-word-4'.  See the on-line
451      documentation for these variables and for the function
452      `ediff-forward-word' for an explanation of how to modify these
453      variables.
454
455    Sometimes, when a region has too many differences between the
456 variants, highlighting of fine differences is inconvenient, especially
457 on color displays.  If that is the case, type `*' with a negative
458 prefix argument.  This unhighlights fine differences for the current
459 region.
460
461    To unhighlight fine differences in all difference regions, use the
462 command `@'.  Repeated typing of this key cycles through three
463 different states: auto-refining, no-auto-refining, and no-highlighting
464 of fine differences.
465
466 
467 File: ediff,  Node: Patch and Diff Programs,  Next: Merging and diff3,  Prev: Refinement of Difference Regions,  Up: Customization
468
469 Patch and Diff Programs
470 =======================
471
472    This section describes variables that specify the programs to be
473 used for applying patches and for computing the main difference regions
474 (not the fine difference regions):
475
476 `ediff-diff-program'
477 `ediff-diff3-program'
478      These variables specify the programs to use to produce differences
479      and do patching.
480
481 `ediff-diff-options'
482 `ediff-diff3-options'
483      These variables specify the options to pass to the above utilities.
484
485      In `ediff-diff-options', it may be useful to specify options such
486      as `-w' that ignore certain kinds of changes.  However, Ediff does
487      not let you use the option `-c', as it doesn't recognize this
488      format yet.
489
490 `ediff-coding-system-for-read'
491      This variable specifies the coding system to use when reading the
492      output that the programs `diff3' and `diff' send to Emacs. The
493      default is `raw-text', and this should work fine on GNU, Unix, and
494      in most cases under Windows NT/95/98/2000.  There are `diff'
495      programs for which the default option doesn't work under Windows.
496      In such cases, `raw-text-dos' might work. If not, you will have to
497      experiment with other coding systems or use GNU diff.
498
499 `ediff-patch-program'
500      The program to use to apply patches.  Since there are certain
501      incompatibilities between the different versions of the patch
502      program, the best way to stay out of trouble is to use a
503      GNU-compatible version.  Otherwise, you may have to tune the
504      values of the variables `ediff-patch-options',
505      `ediff-backup-specs', and `ediff-backup-extension' as described
506      below.
507
508 `ediff-patch-options'
509      Options to pass to `ediff-patch-program'.
510
511      Note: the `-b' and `-z' options should be specified in
512      `ediff-backup-specs', not in `ediff-patch-options'.
513
514      It is recommended to pass the `-f' option to the patch program, so
515      it won't ask questions.  However, some implementations don't
516      accept this option, in which case the default value of this
517      variable should be changed.
518
519 `ediff-backup-extension'
520      Backup extension used by the patch program.  Must be specified,
521      even if `ediff-backup-specs' is given.
522
523 `ediff-backup-specs'
524      Backup directives to pass to the patch program.  Ediff requires
525      that the old version of the file (before applying the patch) is
526      saved in a file named `the-patch-file.extension'.  Usually
527      `extension' is `.orig', but this can be changed by the user, and
528      may also be system-dependent.  Therefore, Ediff needs to know the
529      backup extension used by the patch program.
530
531      Some versions of the patch program let the user specify `-b
532      backup-extension'.  Other versions only permit `-b', which
533      (usually) assumes the extension `.orig'.  Yet others force you to
534      use `-z<backup-extension>'.
535
536      Note that both `ediff-backup-extension' and `ediff-backup-specs'
537      must be properly set.  If your patch program takes the option
538      `-b', but not `-b extension', the variable
539      `ediff-backup-extension' must still be set so Ediff will know
540      which extension to use.
541
542 `ediff-custom-diff-program'
543 `ediff-custom-diff-options'
544      Because Ediff limits the options you may want to pass to the `diff'
545      program, it partially makes up for this drawback by letting you
546      save the output from `diff' in your preferred format, which is
547      specified via the above two variables.
548
549      The output generated by `ediff-custom-diff-program' (which doesn't
550      even have to be a standard-style `diff'!) is not used by Ediff.
551      It is provided exclusively so that you can refer to it later, send
552      it over email, etc.  For instance, after reviewing the
553      differences, you may want to send context differences to a
554      colleague.  Since Ediff ignores the `-c' option in
555      `ediff-diff-program', you would have to run `diff -c' separately
556      just to produce the list of differences.  Fortunately,
557      `ediff-custom-diff-program' and `ediff-custom-diff-options'
558      eliminate this nuisance by keeping a copy of a difference list in
559      the desired format in a buffer that can be displayed via the
560      command `D'.
561
562 `ediff-patch-default-directory'
563      Specifies the default directory to look for patches.
564
565 *Warning:* Ediff does not support the output format of VMS `diff'.
566 Instead, make sure you are using some implementation of POSIX `diff',
567 such as `gnudiff'.
568
569 
570 File: ediff,  Node: Merging and diff3,  Next: Support for Version Control,  Prev: Patch and Diff Programs,  Up: Customization
571
572 Merging and diff3
573 =================
574
575    Ediff supports three-way comparison via the functions `ediff-files3'
576 and `ediff-buffers3'.  The interface is the same as for two-way
577 comparison.  In three-way comparison and merging, Ediff reports if any
578 two difference regions are identical.  For instance, if the current
579 region in buffer A is the same as the region in buffer C, then the mode
580 line of buffer A will display `[=diff(C)]' and the mode line of buffer
581 C will display `[=diff(A)]'.
582
583    Merging is done according to the following algorithm.
584
585    If a difference region in one of the buffers, say B, differs from
586 the ancestor file while the region in the other buffer, A, doesn't,
587 then the merge buffer, C, gets B's region.  Similarly when buffer A's
588 region differs from the ancestor and B's doesn't, A's region is used.
589
590    If both regions in buffers A and B differ from the ancestor file,
591 Ediff chooses the region according to the value of the variable
592 `ediff-default-variant'.  If its value is `default-A' then A's region
593 is chosen.  If it is `default-B' then B's region is chosen.  If it is
594 `combined' then the region in buffer C will look like this:
595
596      <<<<<<< variant A
597      the difference region from buffer A
598      >>>>>>> variant B
599      the difference region from buffer B
600      ####### Ancestor
601      the difference region from the ancestor buffer, if available
602      ======= end
603
604    The above is the default template for the combined region. The user
605 can customize this template using the variable
606 `ediff-combination-pattern'.
607
608    The variable `ediff-combination-pattern' specifies the template that
609 determines how the combined merged region looks like.  The template is
610 represented as a list of the form `(STRING1 Symbol1 STRING2 Symbol2
611 STRING3 Symbol3 STRING4)'. The symbols here must be atoms of the form
612 `A', `B', or `Ancestor'. They determine the order in which the
613 corresponding difference regions (from buffers A, B, and the ancestor
614 buffer) are displayed in the merged region of buffer C.  The strings in
615 the template determine the text that separates the aforesaid regions.
616 The default template is
617
618      ("<<<<<<< variant A" A ">>>>>>> variant B" B
619         "####### Ancestor" Ancestor "======= end")
620
621 (this is one long line) and the corresponding combined region is shown
622 above. The order in which the regions are shown (and the separator
623 strings) can be changed by changing the above template. It is even
624 possible to add or delete region specifiers in this template (although
625 the only possibly useful such modification seems to be the deletion of
626 the ancestor).
627
628    In addition to the state of the difference, Ediff displays the state
629 of the merge for each region.  If a difference came from buffer A by
630 default (because both regions A and B were different from the ancestor
631 and `ediff-default-variant' was set to `default-A') then `[=diff(A)
632 default-A]' is displayed in the mode line.  If the difference in buffer
633 C came, say, from buffer B because the difference region in that buffer
634 differs from the ancestor, but the region in buffer A does not (if
635 merging with an ancestor) then `[=diff(B) prefer-B]' is displayed.  The
636 indicators default-A/B and prefer-A/B are inspired by Emerge and have
637 the same meaning.
638
639    Another indicator of the state of merge is `combined'.  It appears
640 with any difference region in buffer C that was obtained by combining
641 the difference regions in buffers A and B as explained above.
642
643    In addition to the state of merge and state of difference
644 indicators, while merging with an ancestor file or buffer, Ediff
645 informs the user when the current difference region in the (normally
646 invisible) ancestor buffer is empty via the _AncestorEmpty_ indicator.
647 This helps determine if the changes made to the original in variants A
648 and B represent pure insertion or deletion of text: if the mode line
649 shows _AncestorEmpty_ and the corresponding region in buffers A or B is
650 not empty, this means that new text was inserted.  If this indicator is
651 not present and the difference regions in buffers A or B are non-empty,
652 this means that text was modified.  Otherwise, the original text was
653 deleted.
654
655    Although the ancestor buffer is normally invisible, Ediff maintains
656 difference regions there and advances the current difference region
657 accordingly.  All highlighting of difference regions is provided in the
658 ancestor buffer, except for the fine differences.  Therefore, if
659 desired, the user can put the ancestor buffer in a separate frame and
660 watch it there.  However, on a TTY, only one frame can be visible at
661 any given time, and Ediff doesn't support any single-frame window
662 configuration where all buffers, including the ancestor buffer, would
663 be visible.  However, the ancestor buffer can be displayed by typing
664 `/' to the control window.  (Type `C-l' to hide it again.)
665
666    Note that the state-of-difference indicators `=diff(A)' and
667 `=diff(B)' above are not redundant, even in the presence of a
668 state-of-merge indicator.  In fact, the two serve different purposes.
669
670    For instance, if the mode line displays `=diff(B) prefer(B)' and you
671 copy a difference region from buffer A to buffer C then `=diff(B)' will
672 change to `diff-A' and the mode line will display `=diff(A) prefer-B'.
673 This indicates that the difference region in buffer C is identical to
674 that in buffer A, but originally buffer C's region came from buffer B.
675 This is useful to know because you can recover the original difference
676 region in buffer C by typing `r'.
677
678    Ediff never changes the state-of-merge indicator, except in response
679 to the `!' command (see below), in which case the indicator is lost.
680 On the other hand, the state-of-difference indicator is changed
681 automatically by the copying/recovery commands, `a', `b', `r', `+'.
682
683    The `!' command loses the information about origins of the regions
684 in the merge buffer (default-A, prefer-B, or combined).  This is because
685 recomputing differences in this case means running `diff3' on buffers
686 A, B, and the merge buffer, not on the ancestor buffer.  (It makes no
687 sense to recompute differences using the ancestor file, since in the
688 merging mode Ediff assumes that you have not edited buffers A and B,
689 but that you may have edited buffer C, and these changes are to be
690 preserved.)  Since some difference regions may disappear as a result of
691 editing buffer C and others may arise, there is generally no simple way
692 to tell where the various regions in the merge buffer came from.
693
694    In three-way comparison, Ediff tries to disregard regions that
695 consist entirely of white space.  For instance, if, say, the current
696 region in buffer A consists of the white space only (or if it is
697 empty), Ediff will not take it into account for the purpose of
698 computing fine differences.  The result is that Ediff can provide a
699 better visual information regarding the actual fine differences in the
700 non-white regions in buffers B and C.  Moreover, if the regions in
701 buffers B and C differ in the white space only, then a message to this
702 effect will be displayed.
703
704    In the merge mode, the share of the split between window C (the
705 window displaying the merge-buffer) and the windows displaying buffers
706 A and B is controlled by the variable `ediff-merge-window-share'.  Its
707 default value is 0.5.  To make the merge-buffer window smaller, reduce
708 this amount.
709
710    We don't recommend increasing the size of the merge-window to more
711 than half the frame (i.e., to increase the value of
712 `ediff-merge-window-share') to more than 0.5, since it would be hard to
713 see the contents of buffers A and B.
714
715    You can temporarily shrink the merge window to just one line by
716 typing `s'.  This change is temporary, until Ediff finds a reason to
717 redraw the screen.  Typing `s' again restores the original window size.
718
719    With a positive prefix argument, the `s' command will make the merge
720 window slightly taller.  This change is persistent.  With ``-'' or with
721 a negative prefix argument, the command `s' makes the merge window
722 slightly shorter.  This change also persistent.
723
724    Ediff lets you automatically ignore the regions where only one of the
725 buffers A and B disagrees with the ancestor.  To do this, set the
726 variable `ediff-show-clashes-only' to non-`nil'.
727
728    You can toggle this feature interactively by typing `$$'.
729
730    Note that this variable affects only the show next/previous
731 difference commands.  You can still jump directly to any difference
732 region directly using the command `j' (with a prefix argument
733 specifying the difference number).
734
735    The variable `ediff-autostore-merges' controls what happens to the
736 merge buffer when Ediff quits.  If the value is `nil', nothing is done
737 to the merge buffer--it will be the user's responsibility to save it.
738 If the value is `t', the user will be asked where to save the buffer
739 and whether to delete it afterwards.  It the value is neither `nil' nor
740 `t', the merge buffer is saved _only_ if this merge session was invoked
741 from a group of related Ediff session, such as those that result from
742 `ediff-merge-directories', `ediff-merge-directory-revisions', etc.
743 *Note Session Groups::.  This behavior is implemented in the function
744 `ediff-maybe-save-and-delete-merge', which is a hook in
745 `ediff-quit-merge-hook'.  The user can supply a different hook, if
746 necessary.
747
748    The variable `ediff-autostore-merges' is buffer-local, so it can be
749 set in a per-buffer manner.  Therefore, use `setq-default' to globally
750 change this variable.
751
752    When merge buffers are saved automatically as directed by
753 `ediff-autostore-merges', Ediff attaches a prefix to each file, as
754 specified by the variable `ediff-merge-filename-prefix'. The default is
755 `merge_', but this can be changed by the user.
756
757 
758 File: ediff,  Node: Support for Version Control,  Next: Customizing the Mode Line,  Prev: Merging and diff3,  Up: Customization
759
760 Support for Version Control
761 ===========================
762
763    Ediff supports version control and lets you compare versions of files
764 visited by Emacs buffers via the function `ediff-revision'.  This
765 feature is controlled by the following variables:
766
767 `ediff-version-control-package'
768      A symbol.  The default is `vc'.
769
770      If you are like most Emacs users, Ediff will use VC as the version
771      control package.  This is the standard Emacs interface to RCS,
772      CVS, and SCCS.
773
774      However, if your needs are better served by other interfaces, you
775      will have to tell Ediff which version control package you are
776      using, e.g.,
777           (setq ediff-version-control-package 'rcs)
778
779      Apart from the standard `vc.el', Ediff supports three other
780      interfaces to version control: `rcs.el', `pcl-cvs.el' (recently
781      renamed pcvs.el), and `generic-sc.el'.  The package `rcs.el' is
782      written by Sebastian Kremer <sk@thp.Uni-Koeln.DE> and is available
783      as
784           `ftp.cs.buffalo.edu:pub/Emacs/rcs.tar.Z'
785           `ftp.uni-koeln.de:/pub/gnu/emacs/rcs.tar.Z'
786
787    Ediff's interface to the above packages allows the user to compare
788 the versions of the current buffer or to merge them (with or without an
789 ancestor-version).  These operations can also be performed on
790 directories containing files under version control.
791
792    In case of `pcl-cvs.el', Ediff can also be invoked via the function
793 `run-ediff-from-cvs-buffer'--see the documentation string for this
794 function.
795
796 
797 File: ediff,  Node: Customizing the Mode Line,  Next: Miscellaneous,  Prev: Support for Version Control,  Up: Customization
798
799 Customizing the Mode Line
800 =========================
801
802    When Ediff is running, the mode line of `Ediff Control Panel' buffer
803 shows the current difference number and the total number of difference
804 regions in the two files.
805
806    The mode line of the buffers being compared displays the type of the
807 buffer (`A:', `B:', or `C:') and (usually) the file name.  Ediff tries
808 to be intelligent in choosing the mode line buffer identification.  In
809 particular, it works well with the `uniquify.el' and `mode-line.el'
810 packages (which improve on the default way in which Emacs displays
811 buffer identification).  If you don't like the way Ediff changes the
812 mode line, you can use `ediff-prepare-buffer-hook' to modify the mode
813 line.
814
815 
816 File: ediff,  Node: Miscellaneous,  Next: Notes on Heavy-duty Customization,  Prev: Customizing the Mode Line,  Up: Customization
817
818 Miscellaneous
819 =============
820
821    Here are a few other variables for customizing Ediff:
822
823 `ediff-split-window-function'
824      Controls the way you want the window be split between file-A and
825      file-B (and file-C, if applicable).  It defaults to the vertical
826      split (`split-window-vertically', but you can set it to
827      `split-window-horizontally', if you so wish.  Ediff also lets you
828      switch from vertical to horizontal split and back interactively.
829
830      Note that if Ediff detects that all the buffers it compares are
831      displayed in separate frames, it assumes that the user wants them
832      to be so displayed and stops splitting windows.  Instead, it
833      arranges for each buffer to be displayed in a separate frame.  You
834      can switch to the one-frame mode by hiding one of the buffers
835      A/B/C.
836
837      You can also swap the windows where buffers are displayed by typing
838      `~'.
839
840 `ediff-merge-split-window-function'
841      Controls how windows are split between buffers A and B in the
842      merge mode.  This variable is like `ediff-split-window-function',
843      but it defaults to `split-window-horizontally' instead of
844      `split-window-vertically'.
845
846 `ediff-make-wide-display-function'
847      The value is a function to be called to widen the frame for
848      displaying the Ediff buffers.  See the on-line documentation for
849      `ediff-make-wide-display-function' for details.  It is also
850      recommended to look into the source of the default function
851      `ediff-make-wide-display'.
852
853      You can toggle wide/regular display by typing `m'.  In the wide
854      display mode, buffers A, B (and C, when applicable) are displayed
855      in a single frame that is as wide as the entire workstation
856      screen.  This is useful when files are compared side-by-side.  By
857      default, the display is widened without changing its height.
858
859 `ediff-use-last-dir'
860      Controls the way Ediff presents the default directory when it
861      prompts the user for files to compare.  If `nil', Ediff uses the
862      default directory of the current buffer when it prompts the user
863      for file names.  Otherwise, it will use the directories it had
864      previously used for files A, B, or C, respectively.
865
866 `ediff-no-emacs-help-in-control-buffer'
867      If `t', makes `C-h' behave like the <DEL> key, i.e., it will move
868      you back to the previous difference rather than invoking help.
869      This is useful when, in an xterm window or a text-only terminal,
870      the Backspace key is bound to `C-h' and is positioned more
871      conveniently than the <DEL> key.
872
873 `ediff-toggle-read-only-function'
874      This variable's value is a function that Ediff uses to toggle the
875      read-only property in its buffers.
876
877      The default function that Ediff uses simply toggles the read-only
878      property, unless the file is under version control.  For a
879      checked-in file under version control, Ediff first tries to check
880      the file out.
881
882 `ediff-make-buffers-readonly-at-startup nil'
883      If t, all variant buffers are made read-only at Ediff startup.
884
885 `ediff-keep-variants'
886      The default is `t', meaning that the buffers being compared or
887      merged will be preserved when Ediff quits.  Setting this to `nil'
888      causes Ediff to offer the user a chance to delete these buffers
889      (if they are not modified).  Supplying a prefix argument to the
890      quit command (`q') temporarily reverses the meaning of this
891      variable.  This is convenient when the user prefers one of the
892      behaviors most of the time, but occasionally needs the other
893      behavior.
894
895      However, Ediff temporarily resets this variable to `t' if it is
896      invoked via one of the "buffer" jobs, such as `ediff-buffers'.
897      This is because it is all too easy to loose day's work otherwise.
898      Besides, in a "buffer" job, the variant buffers have already been
899      loaded prior to starting Ediff, so Ediff just preserves status quo
900      here.
901
902      Using `ediff-cleanup-hook', one can make Ediff delete the variants
903      unconditionally (e.g., by making `ediff-janitor' into one of these
904      hooks).
905
906 `ediff-grab-mouse'
907      Default is `t'.  Normally, Ediff grabs mouse and puts it in its
908      control frame.  This is useful since the user can be sure that
909      when he needs to type an Ediff command the focus will be in an
910      appropriate Ediff's frame.  However, some users prefer to move the
911      mouse by themselves.  The above variable, if set to `maybe', will
912      prevent Ediff from grabbing the mouse in many situations, usually
913      after commands that may take more time than usual.  In other
914      situation, Ediff will continue grabbing the mouse and putting it
915      where it believes is appropriate.  If the value is `nil', then
916      mouse is entirely user's responsibility.  Try different settings
917      and see which one is for you.
918
919 
920 File: ediff,  Node: Notes on Heavy-duty Customization,  Prev: Miscellaneous,  Up: Customization
921
922 Notes on Heavy-duty Customization
923 =================================
924
925    Some users need to customize Ediff in rather sophisticated ways,
926 which requires different defaults for different kinds of files (e.g.,
927 SGML, etc.).  Ediff supports this kind of customization in several
928 ways.  First, most customization variables are buffer-local.  Those
929 that aren't are usually accessible from within Ediff Control Panel, so
930 one can make them local to the panel by calling make-local-variable
931 from within `ediff-startup-hook'.
932
933    Second, the function `ediff-setup' accepts an optional sixth
934 argument which has the form `((VAR-NAME-1 . VAL-1) (VAR-NAME-2 . VAL-2)
935 ...)'.  The function `ediff-setup' sets the variables in the list to
936 the respective values, locally in the Ediff control buffer.  This is an
937 easy way to throw in custom variables (which usually should be
938 buffer-local) that can then be tested in various hooks.
939
940    Make sure the variable `ediff-job-name' and `ediff-word-mode' are set
941 properly in this case, as some things in Ediff depend on this.
942
943    Finally, if you want custom-tailored help messages, you can set the
944 variables `ediff-brief-help-message-function' and
945 `ediff-long-help-message-function' to functions that return help
946 strings.
947
948    When customizing Ediff, some other variables are useful, although
949 they are not user-definable.  They are local to the Ediff control
950 buffer, so this buffer must be current when you access these variables.
951 The control buffer is accessible via the variable
952 `ediff-control-buffer', which is also local to that buffer.  It is
953 usually used for checking if the current buffer is also the control
954 buffer.
955
956    Other variables of interest are:
957 `ediff-buffer-A'
958      The first of the data buffers being compared.
959
960 `ediff-buffer-B'
961      The second of the data buffers being compared.
962
963 `ediff-buffer-C'
964      In three-way comparisons, this is the third buffer being compared.
965      In merging, this is the merge buffer.  In two-way comparison, this
966      variable is nil.
967
968 `ediff-window-A'
969      The window displaying buffer A.  If buffer A is not visible, this
970      variable is nil or it may be a dead window.
971
972 `ediff-window-B'
973      The window displaying buffer B.
974
975 `ediff-window-C'
976      The window displaying buffer C, if any.
977
978 `ediff-control-frame'
979      A dedicated frame displaying the control buffer, if it exists.  It
980      is non-nil only if Ediff uses the multiframe display, i.e., when
981      the control buffer is in its own frame.
982
983 
984 File: ediff,  Node: Credits,  Next: Index,  Prev: Customization,  Up: Top
985
986 Credits
987 *******
988
989    Ediff was written by Michael Kifer <kifer@cs.sunysb.edu>.  It was
990 inspired by emerge.el written by Dale R. Worley <drw@math.mit.edu>.  An
991 idea due to Boris Goldowsky <boris@cs.rochester.edu> made it possible
992 to highlight fine differences in Ediff buffers.  Alastair Burt
993 <burt@dfki.uni-kl.de> ported Ediff to XEmacs, Eric Freudenthal
994 <freudent@jan.ultra.nyu.edu> made it work with VC, Marc Paquette
995 <marcpa@cam.org> wrote the toolbar support package for Ediff, and
996 Hrvoje Niksic <hniksic@xemacs.org> adapted it to the Emacs
997 customization package.
998
999    Many people provided help with bug reports, patches, and advice.
1000 Without them, Ediff would not be nearly as useful as it is today.  Here
1001 is a full list of contributors (I hope I didn't miss anyone):
1002
1003      Adrian Aichner (aichner@ecf.teradyne.com),
1004      Steve Baur (steve@xemacs.org),
1005      Neal Becker (neal@ctd.comsat.com),
1006      E. Jay Berkenbilt (ejb@ql.org),
1007      Alastair Burt (burt@dfki.uni-kl.de),
1008      Paul Bibilo (peb@delcam.co.uk),
1009      Kevin Broadey (KevinB@bartley.demon.co.uk),
1010      Harald Boegeholz (hwb@machnix.mathematik.uni-stuttgart.de),
1011      Bradley A. Bosch (brad@lachman.com),
1012      Michael D. Carney (carney@ltx-tr.com),
1013      Jin S. Choi (jin@atype.com),
1014      Scott Cummings (cummings@adc.com),
1015      Albert Dvornik (bert@mit.edu),
1016      Eric Eide (eeide@asylum.cs.utah.edu),
1017      Paul Eggert (eggert@twinsun.com),
1018      Urban Engberg (ue@cci.dk),
1019      Kevin Esler (esler@ch.hp.com),
1020      Robert Estes (estes@ece.ucdavis.edu),
1021      Jay Finger (jayf@microsoft.com),
1022      Xavier Fornari (xavier@europe.cma.fr),
1023      Eric Freudenthal (freudent@jan.ultra.nyu.edu),
1024      Job Ganzevoort (Job.Ganzevoort@cwi.nl),
1025      Boris Goldowsky (boris@cs.rochester.edu),
1026      Allan Gottlieb (gottlieb@allan.ultra.nyu.edu),
1027      Aaron Gross (aaron@bfr.co.il),
1028      Thorbjoern Hansen (thorbjoern.hansen@mchp.siemens.de),
1029      Xiaoli Huang (hxl@epic.com),
1030      Andreas Jaeger (aj@suse.de),
1031      Lars Magne Ingebrigtsen (larsi@ifi.uio.no),
1032      Larry Gouge (larry@itginc.com),
1033      Karl Heuer (kwzh@gnu.org),
1034      (irvine@lks.csi.com),
1035      (jaffe@chipmunk.cita.utoronto.ca),
1036      David Karr (dkarr@nmo.gtegsc.com),
1037      Norbert Kiesel (norbert@i3.informatik.rwth-aachen.de),
1038      Sam Steingold (sds@goems.com),
1039      Leigh L Klotz (klotz@adoc.xerox.com),
1040      Fritz Knabe (Fritz.Knabe@ecrc.de),
1041      Heinz Knutzen (hk@informatik.uni-kiel.d400.de),
1042      Andrew Koenig (ark@research.att.com),
1043      Hannu Koivisto (azure@iki.fi),
1044      Ken Laprade (laprade@dw3f.ess.harris.com),
1045      Will C Lauer (wcl@cadre.com),
1046      Richard Levitte (levitte@e.kth.se),
1047      Mike Long (mike.long@analog.com),
1048      Martin Maechler (maechler@stat.math.ethz.ch),
1049      Simon Marshall (simon@gnu.org),
1050      Paul C. Meuse (pmeuse@delcomsys.com),
1051      Richard Mlynarik (mly@adoc.xerox.com),
1052      Stefan Monnier (monnier@cs.yale.edu),
1053      Chris Murphy (murphycm@sun.aston.ac.uk),
1054      Erik Naggum (erik@naggum.no),
1055      Eyvind Ness (Eyvind.Ness@hrp.no),
1056      Ray Nickson (nickson@cs.uq.oz.au),
1057      David Petchey (petchey_david@jpmorgan.com),
1058      Benjamin Pierce (benjamin.pierce@cl.cam.ac.uk),
1059      Francois Pinard (pinard@iro.umontreal.ca),
1060      Tibor Polgar (tlp00@spg.amdahl.com),
1061      David Prince (dave0d@fegs.co.uk),
1062      Paul Raines (raines@slac.stanford.edu),
1063      Bill Richter (richter@math.nwu.edu),
1064      C.S. Roberson (roberson@aur.alcatel.com),
1065      Kevin Rodgers (kevin.rodgers@ihs.com),
1066      Sandy Rutherford (sandy@ibm550.sissa.it),
1067      Heribert Schuetz (schuetz@ecrc.de),
1068      Andy Scott (ascott@pcocd2.intel.com),
1069      Axel Seibert (axel@tumbolia.ppp.informatik.uni-muenchen.de),
1070      Vin Shelton (acs@xemacs.org),
1071      Scott O. Sherman (Scott.Sherman@mci.com),
1072      Richard Stallman (rms@gnu.org),
1073      Richard Stanton (stanton@haas.berkeley.edu),
1074      Ake Stenhoff (etxaksf@aom.ericsson.se),
1075      Stig (stig@hackvan.com),
1076      Peter Stout (Peter_Stout@cs.cmu.edu),
1077      Chuck Thompson (cthomp@cs.uiuc.edu),
1078      Ray Tomlinson (tomlinso@bbn.com),
1079      Raymond Toy (toy@rtp.ericsson.se),
1080      Jan Vroonhof (vroonhof@math.ethz.ch),
1081      Colin Walters (walters@cis.ohio-state.edu),
1082      Philippe Waroquiers (philippe.waroquiers@eurocontrol.be),
1083      Klaus Weber (gizmo@zork.north.de),