Mercurial > hg > xemacs-beta
comparison man/ediff.texi @ 0:376386a54a3c r19-14
Import from CVS: tag r19-14
author | cvs |
---|---|
date | Mon, 13 Aug 2007 08:45:50 +0200 |
parents | |
children | ac2d302a0011 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:376386a54a3c |
---|---|
1 \input texinfo @c -*-texinfo-*- | |
2 @c documentation for Ediff | |
3 @c Written by Michael Kifer | |
4 | |
5 @comment %**start of header (This is for running Texinfo on a region.) | |
6 | |
7 @comment Using ediff.info instead of ediff in setfilename breaks DOS. | |
8 @setfilename ../info/ediff.info | |
9 @comment @setfilename ediff.info | |
10 | |
11 @settitle Ediff User's Manual | |
12 @synindex vr cp | |
13 @synindex fn cp | |
14 @synindex pg cp | |
15 @iftex | |
16 @finalout | |
17 @end iftex | |
18 @c @smallbook | |
19 @comment %**end of header (This is for running Texinfo on a region.) | |
20 | |
21 @ifinfo | |
22 This file documents Ediff, a comprehensive visual interface to Unix diff | |
23 and patch utilities. | |
24 | |
25 Permission is granted to make and distribute verbatim copies of this | |
26 manual provided the copyright notice and this permission notice are | |
27 preserved on all copies. | |
28 | |
29 @ignore | |
30 Permission is granted to process this file through TeX and print the | |
31 results, provided the printed document carries copying permission notice | |
32 identical to this one except for the removal of this paragraph (this | |
33 paragraph not being relevant to the printed manual). | |
34 | |
35 @end ignore | |
36 @end ifinfo | |
37 | |
38 @iftex | |
39 @titlepage | |
40 @title Ediff User's Manual | |
41 @sp 4 | |
42 @subtitle Ediff version 2.61 | |
43 @sp 1 | |
44 @subtitle June 1996 | |
45 @sp 5 | |
46 @author Michael Kifer | |
47 @page | |
48 | |
49 @vskip 0pt plus 1filll | |
50 @noindent | |
51 Copyright @copyright{} 1995, 1996 Free Software Foundation, Inc. | |
52 | |
53 Permission is granted to make and distribute verbatim copies of | |
54 this manual provided the copyright notice and this permission notice | |
55 are preserved on all copies. | |
56 @end titlepage | |
57 @page | |
58 @end iftex | |
59 | |
60 @node Top, Introduction, (dir), (dir) | |
61 | |
62 @menu | |
63 * Introduction:: About Ediff. | |
64 * Major Entry Points:: How to use Ediff. | |
65 * Commands:: Ediff commands. | |
66 * Registry of Ediff Sessions:: Keeping track of multiple Ediff sessions. | |
67 * Session Groups:: Comparing and merging directories. | |
68 * Remote and Compressed Files:: You may want to know about this. | |
69 * Customization:: How to make Ediff work the way YOU want. | |
70 * Credits:: Thanks to those who helped. | |
71 * Index:: | |
72 @end menu | |
73 | |
74 @node Introduction, Major Entry Points, Top, Top | |
75 @chapter Introduction | |
76 | |
77 @cindex Comparing files and buffers | |
78 @cindex Merging files and buffers | |
79 @cindex Patching files and buffers | |
80 @cindex Finding differences | |
81 | |
82 Ediff provides a convenient way for simultaneous browsing through | |
83 the differences between a pair (or a triple) of files or buffers. The | |
84 files being compared, file-A, file-B, and file-C (if applicable) are | |
85 shown in separate windows (side by side, one above the another, or in | |
86 separate frames), and the differences are highlighted as you step | |
87 through them. You can also copy difference regions from one buffer to | |
88 another (and recover old differences if you change your mind). | |
89 | |
90 Another powerful feature is the ability to merge a pair of files into a | |
91 third buffer. Merging with an ancestor file is also supported. | |
92 Furthermore, Ediff is equipped with directory-level capabilities that | |
93 allow the user to conveniently launch browsing or merging sessions on | |
94 groups of files in two (or three) different directories. | |
95 | |
96 In addition, Ediff can apply a patch to a file and then let you step though | |
97 both files, the patched and the original one, simultaneously, | |
98 difference-by-difference. You can even apply a patch right out of a mail | |
99 buffer, i.e., patches received by mail don't even have to be saved. Since | |
100 Ediff lets you copy differences between buffers, you can, in effect, apply | |
101 patches selectively (i.e., you can copy a difference region from | |
102 @file{file_orig} to @file{file}, thereby undoing any particular patch that | |
103 you don't like). | |
104 | |
105 Ediff even understands multi-file patches and can apply them interactively! | |
106 (Ediff can recognize multi-file patches only if they are in the context or | |
107 GNU unified format. All other patches are treated as 1-file patches. Ediff | |
108 is [hopefully] using the same algorithm as patch to determine which | |
109 files need to be patched.) | |
110 | |
111 Ediff is aware of version control, which lets you compare | |
112 files with their older versions. Ediff also works with remote and | |
113 compressed files, automatically ftp'ing them over and uncompressing them. | |
114 @xref{Remote and Compressed Files}, for details. | |
115 | |
116 This package builds upon ideas borrowed from Emerge and | |
117 several Ediff's functions are adaptations from Emerge. | |
118 Although Ediff subsumes Emerge, | |
119 much of the functionality of Ediff is influenced by Emerge. | |
120 The architecture and the interface are, of course, drastically different. | |
121 | |
122 @node Major Entry Points, Commands, Introduction, Top | |
123 @chapter Major Entry Points | |
124 | |
125 Ediff can be invoked interactively using the following functions, which can | |
126 be run either from the minibuffer or from the menu bar. In the menu bar, | |
127 all Ediff's entry points belong to three submenus of the Tools menu: | |
128 Compare, Merge, and Apply Patch. | |
129 | |
130 @table @code | |
131 @item ediff-files | |
132 @itemx ediff | |
133 @findex ediff-files | |
134 @findex ediff | |
135 Compare two files. | |
136 | |
137 @item ediff-buffers | |
138 @findex ediff-buffers | |
139 Compare two buffers. | |
140 | |
141 @item ediff-files3 | |
142 @itemx ediff3 | |
143 @findex ediff-files3 | |
144 @findex ediff3 | |
145 Compare three files. | |
146 | |
147 @item ediff-buffers3 | |
148 @findex ediff-buffers3 | |
149 Compare three buffers. | |
150 | |
151 @item edirs | |
152 @itemx ediff-directories | |
153 @findex edirs | |
154 @findex ediff-directories | |
155 Compare files common to two directories. | |
156 @item edirs3 | |
157 @itemx ediff-directories3 | |
158 @findex edirs3 | |
159 @findex ediff-directories3 | |
160 Compare files common to three directories. | |
161 @item edir-revisions | |
162 @itemx ediff-directory-revisions | |
163 @findex ediff-directory-revisions | |
164 @findex edir-revisions | |
165 Compare versions of files in a given directory. Ediff selects only the | |
166 files that are under version control. | |
167 @item edir-merge-revisions | |
168 @itemx ediff-merge-directory-revisions | |
169 @findex edir-merge-revisions | |
170 @findex ediff-merge-directory-revisions | |
171 Merge versions of files in a given directory. Ediff selects only the | |
172 files that are under version control. | |
173 @item edir-merge-revisions-with-ancestor | |
174 @itemx ediff-merge-directory-revisions-with-ancestor | |
175 @findex edir-merge-revisions-with-ancestor | |
176 @findex ediff-merge-directory-revisions-with-ancestor | |
177 Merge versions of files in a given directory using other versions as | |
178 ancestors. Ediff selects only the files that are under version control. | |
179 | |
180 @item ediff-windows-wordwise | |
181 @findex ediff-windows-wordwise | |
182 Compare windows word-by-word. | |
183 | |
184 @item ediff-windows-linewise | |
185 @findex ediff-windows-linewise | |
186 Compare windows line-by-line. | |
187 | |
188 @item ediff-regions-wordwise | |
189 @findex ediff-regions-wordwise | |
190 Compare regions word-by-word. | |
191 | |
192 @item ediff-regions-linewise | |
193 @findex ediff-regions-linewise | |
194 Compare regions line-by-line. | |
195 | |
196 @item ediff-revision | |
197 @findex ediff-revision | |
198 Compare versions of the current buffer, if the buffer is visiting | |
199 a file under version control. | |
200 | |
201 @item ediff-patch-file | |
202 @itemx epatch | |
203 @findex ediff-patch-file | |
204 @findex epatch | |
205 Patch a file, then compare. | |
206 @item ediff-patch-buffer | |
207 @itemx epatch-buffer | |
208 @findex ediff-patch-buffer | |
209 Patch a buffer, then compare. | |
210 | |
211 @item ediff-merge-files | |
212 @itemx ediff-merge | |
213 @findex ediff-merge-files | |
214 @findex ediff-merge | |
215 Merge two files. | |
216 | |
217 @item ediff-merge-files-with-ancestor | |
218 @itemx ediff-merge-with-ancestor | |
219 @findex ediff-merge-files-with-ancestor | |
220 @findex ediff-merge-with-ancestor | |
221 Like @code{ediff-merge}, but with a third ancestor file. | |
222 | |
223 @item ediff-merge-buffers | |
224 @findex ediff-merge-buffers | |
225 Merge two buffers. | |
226 | |
227 @item ediff-merge-buffers-with-ancestor | |
228 @findex ediff-merge-buffers-with-ancestor | |
229 Same but with ancestor. | |
230 | |
231 | |
232 @item edirs-merge | |
233 @itemx ediff-merge-directories | |
234 @findex edirs-merge | |
235 @findex ediff-merge-directories | |
236 Merge files common to two directories. | |
237 @item edirs-merge-with-ancestor | |
238 @itemx ediff-merge-directories-with-ancestor | |
239 @findex edirs-merge-with-ancestor | |
240 @findex ediff-merge-directories-with-ancestor | |
241 Same but using files in a third directory as ancestors. | |
242 | |
243 @item ediff-merge-revisions | |
244 @findex ediff-merge-revisions | |
245 Merge two versions of the file visited by the current buffer. | |
246 | |
247 @item ediff-merge-revisions-with-ancestor | |
248 @findex ediff-merge-revisions-with-ancestor | |
249 Same but with ancestor. | |
250 @end table | |
251 | |
252 @noindent | |
253 If you want Ediff to be loaded from the very beginning of your Emacs | |
254 session, you should put this line in your @file{~/.emacs} file: | |
255 | |
256 @example | |
257 (require 'ediff) | |
258 @end example | |
259 | |
260 @noindent | |
261 Otherwise, Ediff will be loaded automatically when you use one of the | |
262 above functions, either directly or through the menus. | |
263 | |
264 When the above functions are invoked, they prompt the user for the | |
265 information they need---typically the files or buffers to compare or | |
266 patch. Ediff tries to be smart about these prompts. For instance, in | |
267 comparing/merging files, it will offer the visible buffers as defaults. In | |
268 prompting for files, if the user enters a directory, the previously input | |
269 file name will be appended to that directory. In addition, if the variable | |
270 @code{ediff-use-last-dir} is not @code{nil}, Ediff will offer | |
271 previously entered directories as defaults (which will be maintained | |
272 separately for each type of file, A, B, or C). | |
273 @vindex @code{ediff-use-last-dir} | |
274 | |
275 All the above functions use the POSIX @code{diff} program to find | |
276 differences between two files. They process the @code{diff} output and | |
277 display it in a convenient form. At present, Ediff understands only the | |
278 plain output from diff. Options such as @samp{-c} are not supported, | |
279 nor is the format produced by incompatible file comparison programs such | |
280 as the VMS version of @code{diff}. | |
281 | |
282 The functions @code{ediff-files}, @code{ediff-buffers}, | |
283 @code{ediff-files3}, @code{ediff-buffers3} first display the coarse, | |
284 line-based difference regions, as reported by the @file{diff} program. | |
285 Since diff may report fairly large chunks of text as being different, | |
286 even though the difference may be localized to just a few words or even | |
287 to the white space or line breaks, Ediff further @emph{refines} the | |
288 regions to indicate which exact words differ. If the only difference is | |
289 in the white space and line breaks, Ediff says so. | |
290 | |
291 On a color display, fine differences are highlighted with color; on a | |
292 monochrome display, they are underlined. @xref{Highlighting Difference | |
293 Regions}, for information on how to customize this. | |
294 | |
295 The functions @code{ediff-windows-wordwise}, | |
296 @code{ediff-windows-linewise}, @code{ediff-regions-wordwise} and | |
297 @code{ediff-regions-linewise} do comparison on parts of existing Emacs | |
298 buffers. Since @code{ediff-windows-wordwise} and | |
299 @code{ediff-regions-wordwise} are intended for relatively small segments | |
300 of buffers, comparison is done on the basis of words rather than lines. | |
301 No refinement is necessary in this case. These commands are recommended | |
302 only for relatively small regions (perhaps, up to 100 lines), because | |
303 these functions have a relatively slow startup. | |
304 | |
305 To compare large regions, use @code{ediff-regions-linewise}. This | |
306 command displays differences much like @code{ediff-files} and | |
307 @code{ediff-buffers}. | |
308 | |
309 The functions @code{ediff-patch-file} and @code{ediff-patch-buffer} apply a | |
310 patch to a file or a buffer and then run Ediff on these buffers, displaying | |
311 the difference regions. | |
312 | |
313 The entry points @code{ediff-directories}, @code{ediff-merge-directories}, | |
314 etc., provide a convenient interface for comparing and merging files in | |
315 different directories. The user is presented with Dired-like interface from | |
316 which one can run a group of related Ediff sessions. | |
317 | |
318 For files under version control, @code{ediff-revisions} lets you compare | |
319 the file visited by the current buffer to one of its checked-in versions. | |
320 You can also compare two checked-in versions of the visited file. | |
321 Moreover, the functions @code{ediff-directory-revisions}, | |
322 @code{ediff-merge-directory-revisions}, etc., let you run a group of | |
323 related Ediff sessions by taking a directory and comparing (or merging) | |
324 versions of files in that directory. | |
325 | |
326 @node Commands, Registry of Ediff Sessions, Major Entry Points, Top | |
327 @chapter Commands | |
328 | |
329 All Ediff commands are displayed in a quick | |
330 help window, unless you type @kbd{?} to shrink the window to just one line. | |
331 You can redisplay the help window by typing @kbd{?} again. | |
332 In this section | |
333 we comment only on the features that cannot be readily deduced from the | |
334 quick help window. | |
335 You can always type @kbd{E} in the control window to display this manual. | |
336 | |
337 Many Ediff commands take numeric prefix arguments. For instance, if you | |
338 type a number, say 3, and then @kbd{j} (@code{ediff-jump-to-difference}), Ediff | |
339 moves to the third difference region. Typing 3 and then @kbd{a} | |
340 (@code{ediff-diff-to-diff}) copies the 3d difference region from buffer | |
341 A to buffer B. Typing @kbd{b} does copying in the opposite | |
342 direction. (In 3-way comparison mode, the commands for copying are | |
343 @kbd{ab}, @kbd{ba}, @kbd{ca}, etc.) | |
344 Likewise, 4 followed by @kbd{ra} | |
345 restores the 4th difference region in buffer A (if it was previously | |
346 saved as a result of copying from, say, buffer B to A). | |
347 | |
348 Some commands take negative prefix arguments as well. | |
349 For instance, typing @kbd{-} and then @kbd{j} will take Ediff to the last | |
350 difference. Typing @kbd{-2} then @kbd{j} takes Ediff to to the penultimate | |
351 difference region, etc. | |
352 | |
353 Without the prefix argument, all commands operate on the current | |
354 selected difference region. You can select any difference region | |
355 as the current one using other Ediff commands. | |
356 | |
357 For some commands, the value of the prefix argument is immaterial. However, | |
358 if supplied, the prefix argument modifies the command. For instance, | |
359 normally the commands @kbd{ga}/@kbd{gb}/@kbd{gc} | |
360 (@code{ediff-jump-to-difference-at-point}) causes Ediff to jump to the | |
361 difference region that is closest to the point in a specified buffer (the | |
362 buffer, A, B, or C, is specified by the last character of the command, | |
363 i.e., for @code{gb}, the specified buffer is B). | |
364 However, with a prefix argument, Ediff would position all these | |
365 buffers around the area indicated by the current point in the specified | |
366 buffer: if the point is inside a difference region, then the buffers will | |
367 be positioned at this difference region. If the point is not in any | |
368 difference region, then it is in an area where all buffers agree with each | |
369 other. In this case, all buffers will be positioned so that they would | |
370 display this area. | |
371 | |
372 The total number of differences and the current difference number are | |
373 always displayed in the mode line of the control window. | |
374 | |
375 If, after making changes to buffers A, B, or C, you decide to save them, it | |
376 is best to use @code{ediff-save-buffer}, which is bound to @kbd{wa}, | |
377 @kbd{wb}, and @kbd{wc} (@kbd{wa} will save buffer A, @kbd{wb} saves buffer | |
378 B, etc.). | |
379 | |
380 Typing @kbd{wd} saves the output from the @code{diff} utility to a file, so | |
381 you can later refer to it. With prefix argument, this command saves the | |
382 plain output from @file{diff} (see @code{ediff-diff-program} and | |
383 @code{ediff-diff-options}). Without the argument, it saves customized | |
384 @file{diff} output (see @code{ediff-custom-diff-program} and | |
385 @code{ediff-custom-diff-options}), if it is available. | |
386 | |
387 Instead of saving it, @file{diff} output can be @emph{displayed} using the | |
388 command @kbd{D}. Without the prefix argument, it displays the customized | |
389 @file{diff} output of the session. With the prefix argument, it displays | |
390 the plain @file{diff} output If either of the @file{diff} outputs is | |
391 unavailable (because it wasn't generated or the user killed the respective | |
392 buffer), then Ediff will try to display the other @file{diff} output. If | |
393 none is available, a warning is issued. | |
394 | |
395 The command @kbd{z} suspends the current ediff session. It hides the | |
396 control buffer and the variants. The easiest way to resume a suspended | |
397 Ediff session is through the registry of active sessions. | |
398 @xref{Registry of Ediff Sessions}, for details. | |
399 | |
400 The command @kbd{q} quits the current Ediff session. With a prefix | |
401 argument, it will ask the user whether to delete the variant | |
402 buffers. | |
403 | |
404 The command @kbd{s} is used only for merging. It shrinks window C (the | |
405 merge window) to its minimal size, thereby exposing as much of buffers A | |
406 and B as possible. This command is intended only for temporary viewing; | |
407 therefore, Ediff restores window C to its original size whenever it | |
408 makes any other change in the window configuration. Typing @kbd{s} | |
409 again also restores the original size of window C. However, recentering and | |
410 jumping to a difference does not affect window C's size. | |
411 | |
412 With a positive prefix argument, the command @kbd{s} makes the merge | |
413 window, window C, slightly taller. With @kbd{-} or a negative prefix | |
414 argument, @kbd{s} makes window C slightly shorter. | |
415 | |
416 Another command used only for merging is @kbd{+}. Its effect is to | |
417 combine the current difference regions of buffers A and B and put the | |
418 combination into the merge buffer. @xref{Merging and diff3}, specifically, | |
419 the variables @code{ediff-combine-diffs} and | |
420 @code{ediff-combination-pattern}. | |
421 | |
422 In merge mode, Ediff uses a default variant (one of the two files being | |
423 merged) when it cannot decide which of the difference regions (that of | |
424 buffer A or buffer B) should be copied into the merge buffer. You might | |
425 decide to use the other variant instead. To facilitate this, Ediff has | |
426 a command, bound to @kbd{&}, which selects another default variant for | |
427 the current difference and subsequent differences. You can specify as | |
428 the new default any of @samp{default-A}, @samp{default-B}, or | |
429 @samp{combined}. @xref{Merging and diff3}, for details. | |
430 | |
431 Such repeated merging affects only difference regions that have | |
432 default-A/B status, and only if they were not changed with respect to | |
433 their originals. | |
434 | |
435 Some commands are not bound to any key: | |
436 | |
437 @table @code | |
438 @item eregistry | |
439 @itemx ediff-show-registry | |
440 @findex eregistry | |
441 @findex ediff-show-registry | |
442 This command brings up the registry of active Ediff sessions. Ediff | |
443 registry is a useful device that can be used for resuming Ediff sessions | |
444 when the user switched to some other work before finishing a comparison or | |
445 merging job. It is also useful for switching between multiple active Ediff | |
446 sessions that are run at the same time. The function @code{eregistry} is an | |
447 alias for @code{ediff-show-registry}. | |
448 @item ediff-toggle-multiframe | |
449 @findex ediff-toggle-multiframe | |
450 Changes the display from the multi-frame mode (where the quick help window | |
451 is in a separate frame) to the single-frame mode (where all Ediff buffers | |
452 share the same frame), and vice versa. | |
453 @item ediff-revert-buffers-then-recompute-diffs | |
454 @findex ediff-revert-buffers-then-recompute-diffs | |
455 This command reverts the buffers you are comparing and recomputes their | |
456 differences. It is useful when, after making changes, you decided to | |
457 make a fresh start, or if at some point you changed the files being | |
458 compared but want to discard any changes to comparison buffers that were | |
459 done since then. | |
460 | |
461 This command normally asks for confirmation before reverting files. | |
462 With a prefix argument, it reverts files without asking. | |
463 | |
464 | |
465 @item ediff-profile | |
466 @findex ediff-profile | |
467 Ediff has an admittedly primitive (but useful) facility for profiling | |
468 Ediff's commands. It is meant for Ediff maintenance---specifically, for | |
469 making it run faster. The function @code{ediff-profile} toggles | |
470 profiling of ediff commands. | |
471 @end table | |
472 | |
473 @node Registry of Ediff Sessions, Session Groups, Commands, Top | |
474 @chapter Registry of Ediff Sessions | |
475 | |
476 Ediff maintains a registry of all its invocations that are | |
477 still @emph{active}. This feature is very convenient for switching among | |
478 active Ediff sessions or for quickly restarting a suspended Ediff session. | |
479 | |
480 The focal point of this activity is a buffer | |
481 called @emph{*Ediff Registry*}. You can display this buffer by typing | |
482 @kbd{R} in any Ediff Control Buffer or Session Group Buffer | |
483 (@pxref{Session Groups}), or by typing | |
484 @kbd{M-x eregistry} into the Minibuffer. | |
485 The latter would be the fastest way to bring up the registry | |
486 buffer if no control or group buffer is displayed in any of the visible | |
487 Emacs windows. | |
488 If you are in a habit of running multiple long Ediff sessions and often need to | |
489 suspend, resume, or switch between them, it may be a good idea to have the | |
490 registry buffer permanently displayed in a separate, dedicated window. | |
491 | |
492 The registry buffer has several convenient key bindings. | |
493 For instance, clicking mouse button 2 or typing | |
494 @kbd{RET} or @kbd{v} over any session record resumes that session. | |
495 Session records in the registry buffer provide a fairly complete | |
496 description of each session, so it is usually easy to identify the right | |
497 session to resume. | |
498 | |
499 Other useful commands are bound to @kbd{SPC} (next registry record) | |
500 and @kbd{DEL} (previous registry record). There are other commands as well, | |
501 but you don't need to memorize them, since they are listed at the top of | |
502 the registry buffer. | |
503 | |
504 @node Session Groups, Remote and Compressed Files, Registry of Ediff Sessions, Top | |
505 @chapter Session Groups | |
506 | |
507 Several major entries of Ediff perform comparison and merging on | |
508 directories. On entering @code{ediff-directories}, | |
509 @code{ediff-directories3}, | |
510 @code{ediff-merge-directories}, | |
511 @code{ediff-merge-directories-with-ancestor}, | |
512 @code{ediff-directory-revisions}, | |
513 @code{ediff-merge-directory-revisions}, or | |
514 @code{ediff-merge-directory-revisions-with-ancestor}, | |
515 the user is presented with a | |
516 Dired-like buffer that lists files common to the directories involved along | |
517 with their sizes. (The list of common files can be further filtered through | |
518 a regular expression, which the user is prompted for.) We call this buffer | |
519 @emph{Session Group Panel} because all Ediff sessions associated with the | |
520 listed files will have this buffer as a common focal point. | |
521 | |
522 Clicking button 2 or typing @kbd{RET} or @kbd{v} over a | |
523 record describing files invokes Ediff in the appropriate mode on these | |
524 files. You can come back to the session group buffer associated with a | |
525 particular invocation of Ediff by typing @kbd{M} in Ediff control buffer of | |
526 that invocation. | |
527 | |
528 Many commands are available in the session group buffer; some are | |
529 applicable only for certain types of work. The relevant commands are always | |
530 listed at the top of each session group buffer, so there is no need to | |
531 memorize them. | |
532 | |
533 In directory comparison or merging, a session group panel displays only the | |
534 files common to all directories involved. The differences are kept in a | |
535 separate buffer and are conveniently displayed by typing @kbd{D} to the | |
536 corresponding session group panel. Thus, as an added benefit, Ediff can be | |
537 used to compare the contents of up to three directories. | |
538 | |
539 Session records in session group panels are also marked with @kbd{+}, for | |
540 active sessions, and with @kbd{-}, for finished sessions. | |
541 | |
542 Sometimes, it is convenient to exclude certain session records from a group. | |
543 Usually this happens when the user doesn't intend to run Ediff of certain | |
544 files in the group, and the corresponding session records just add clutter | |
545 to the session group buffer. To help alleviate this problem, the user can | |
546 type @kbd{h} to mark a session as a candidate for exclusion and @kbd{x} to | |
547 actually hide the marked sessions. There actions are reversible: with a | |
548 prefix argument, @kbd{h} unmarks the session under the cursor, and @kbd{x} | |
549 brings the hidden sessions into the view (@kbd{x} doesn't unmark them, | |
550 though, so the user has to explicitly unmark the sessions of interest). | |
551 | |
552 Group sessions also understand the command @kbd{m}, which marks sessions | |
553 for future operations (other than hiding) on a group of sessions. At present, | |
554 the only such group-level operation is the creation of a multi-file patch. | |
555 | |
556 @cindex Multi-file patches | |
557 A multi-file patch is a concatenated output of several runs of the Unix | |
558 @file{diff} command (some versions of @file{diff} let you create a | |
559 multi-file patch in just one run). In a session group buffer created in | |
560 response to @code{ediff-directories} or @code{ediff-directory-revisions}, | |
561 the user can type @kbd{P} to create a multi-file patch of marked sessions | |
562 (which must be marked using the @kbd{m} command). Ediff then will display | |
563 a buffer containing the patch. In an @code{ediff-directories} session, it | |
564 is enough to just mark the requisite sessions. In | |
565 @code{ediff-directory-revisions} revisions, the marked sessions must also | |
566 be active, or else Ediff will refuse to produce a multi-file patch. This is | |
567 because, in the latter-style sessions, there are many ways to create diff | |
568 output, and it is easier to handle by running Ediff on the inactive | |
569 sessions. | |
570 | |
571 | |
572 @node Remote and Compressed Files, Customization, Session Groups, Top | |
573 @chapter Remote and Compressed Files | |
574 | |
575 Ediff works with remote, compressed, and encrypted files. Ediff | |
576 supports @file{ange-ftp.el}, @file{jka-compr.el}, @file{uncompress.el} | |
577 and @file{crypt++.el}, but it may work with other similar packages as | |
578 well. This means that you can compare files residing on another | |
579 machine, or you can apply a patch to a file on another machine. Even | |
580 the patch itself can be a remote file! | |
581 | |
582 When patching compressed or remote files, Ediff does not rename the source | |
583 file (unlike what the @code{patch} utility would usually do). Instead, the | |
584 source file retains its name and the result of applying the patch is placed | |
585 in a temporary file that has the suffix @file{_patched} attached. | |
586 Generally, this applies to files that are handled using black magic, such | |
587 as special file handlers (ange-ftp and some compression and encryption | |
588 packages all use this method). | |
589 | |
590 Regular files are treated by the @code{patch} utility in the usual manner, | |
591 i.e., the original is renamed into @file{source-name.orig} and the result | |
592 of the patch is placed into the file source-name. (Ediff @file{_orig} | |
593 on systems like VMS, DOS, etc.) | |
594 | |
595 @node Customization, Credits, Remote and Compressed Files, Top | |
596 @chapter Customization | |
597 | |
598 Ediff has a rather self-explanatory interface, and in most cases you | |
599 won't need to change anything. However, should the need arise, there are | |
600 extensive facilities to change the default behavior. | |
601 | |
602 Most of the customization can be done by setting various variables in the | |
603 @file{.emacs} file. Some customization (mostly window-related | |
604 customization and faces) can be done by putting appropriate lines in | |
605 @file{.Xdefaults}, @file{.xrdb}, or whatever X resource file is in use. | |
606 | |
607 With respect to the latter, please note that the X resource | |
608 for Ediff customization is `Ediff', @emph{not} `emacs'. | |
609 @xref{Window and Frame Configuration}, | |
610 @xref{Highlighting Difference Regions}, for further details. Please also | |
611 refer to Emacs manual for the information on how to set Emacs X resources. | |
612 | |
613 @menu | |
614 * Hooks:: Customization via the hooks. | |
615 * Quick Help:: How to customize Ediff's quick help feature. | |
616 * Window and Frame Configuration:: Controlling the way Ediff displays things. | |
617 * Selective Browsing:: Advanced browsing through difference regions. | |
618 * Highlighting Difference Regions:: Controlling highlighting. | |
619 * Narrowing:: Comparing regions, windows, etc. | |
620 * Refinement of Difference Regions:: How to control the refinement process. | |
621 * Patch and Diff Programs:: Changing the utilities that compute differences | |
622 and apply patches. | |
623 * Merging and diff3:: How to customize Ediff in its Merge Mode. | |
624 * Support for Version Control:: Changing the version control package. | |
625 You are not likely to do that. | |
626 * Customizing the Mode Line:: Changing the look of the mode line in Ediff. | |
627 * Miscellaneous:: Other customization. | |
628 * Notes on Heavy-duty Customization:: Customization for the gurus. | |
629 @end menu | |
630 | |
631 @node Hooks, Quick Help, Customization, Customization | |
632 @section Hooks | |
633 | |
634 The bulk of customization can be done via the following hooks: | |
635 | |
636 @table @code | |
637 @item ediff-load-hook | |
638 @vindex ediff-load-hook | |
639 This hook can be used to change defaults after Ediff is loaded. | |
640 | |
641 @item ediff-keymap-setup-hook | |
642 @vindex ediff-keymap-setup-hook | |
643 This hook can be used to alter bindings in Ediff's keymap. These hooks are | |
644 run right after the default bindings are set but before | |
645 @code{ediff-load-hook}. The regular user needs not be concerned with this | |
646 hook---it is provided for implementors of other Emacs packages built on top | |
647 of Ediff. | |
648 | |
649 @item ediff-before-setup-windows-hook | |
650 @itemx ediff-after-setup-windows-hook | |
651 @vindex ediff-before-setup-windows-hook | |
652 @vindex ediff-after-setup-windows-hook | |
653 These two hooks are called before and after Ediff sets up its window | |
654 configuration. Can be used to save the configuration that existed | |
655 before Ediff starts or for whatever other purposes. | |
656 | |
657 @item ediff-suspend-hook | |
658 @itemx ediff-quit-hook | |
659 @vindex ediff-suspend-hook | |
660 @vindex ediff-quit-hook | |
661 These two hooks are run when you suspend or quit Ediff. They can be | |
662 used to set desired window configurations, delete files Ediff didn't | |
663 want to clean up after exiting, etc. | |
664 | |
665 By default, @code{ediff-quit-hook} holds one hook function, | |
666 @code{ediff-cleanup-mess}, which cleans after Ediff, as appropriate in | |
667 most cases. You probably won't want to change it, but you might | |
668 want to add other hook functions. | |
669 | |
670 Keep in mind that hooks executing before @code{ediff-cleanup-mess} start | |
671 in @code{ediff-control-buffer;} they should also leave | |
672 @code{ediff-control-buffer} as the current buffer when they finish. | |
673 Hooks that are executed after @code{ediff-cleanup-mess} should expect | |
674 the current buffer be either buffer A or buffer B. | |
675 @code{ediff-cleanup-mess} doesn't kill the buffers being compared or | |
676 merged (see @code{ediff-cleanup-hook}, below). | |
677 | |
678 @item ediff-cleanup-hook | |
679 @vindex ediff-cleanup-hook | |
680 This hook is run just before @code{ediff-quit-hook}. This is a good | |
681 place to do various cleanups, such as deleting the variant buffers. | |
682 Ediff provides a function, @code{ediff-janitor}, as one such possible | |
683 hook, which you can add to @code{ediff-cleanup-hook} with | |
684 @code{add-hooks}. | |
685 | |
686 @findex ediff-janitor | |
687 This function kills buffers A, B, and, possibly, C, if these buffers aren't | |
688 modified. In merge jobs, buffer C is never deleted. However, the side | |
689 effect of using this function is that you may not be able to compare the | |
690 same buffer in two separate Ediff sessions: quitting one of them will | |
691 delete this buffer in another session as well. | |
692 | |
693 @item ediff-before-setup-control-frame-hook | |
694 @itemx ediff-after-setup-control-frame-hook | |
695 @vindex ediff-before-setup-control-frame-hook | |
696 @vindex ediff-after-setup-control-frame-hook | |
697 These two hooks run before and after Ediff sets up the control frame. | |
698 They can be used to relocate Ediff control frame when Ediff runs in a | |
699 multiframe mode (i.e., when the control buffer is in its own dedicated | |
700 frame). Be aware that many variables that drive Ediff are local to | |
701 Ediff Control Panel (@code{ediff-control-buffer}), which requires | |
702 special care in writing these hooks. Take a look at | |
703 @code{ediff-default-suspend-hook} and @code{ediff-default-quit-hook} to | |
704 see what's involved. | |
705 | |
706 @item ediff-startup-hook | |
707 @vindex ediff-startup-hook | |
708 This hook is run at the end of Ediff startup. | |
709 | |
710 @item ediff-select-hook | |
711 @vindex ediff-select-hook | |
712 This hook is run after Ediff selects the next difference region. | |
713 | |
714 @item ediff-unselect-hook | |
715 @vindex ediff-unselect-hook | |
716 This hook is run after Ediff unselects the current difference region. | |
717 | |
718 @item ediff-prepare-buffer-hook | |
719 @vindex ediff-prepare-buffer-hook | |
720 This hook is run for each Ediff buffer (A, B, C) right after the buffer | |
721 is arranged. | |
722 | |
723 @item ediff-display-help-hook | |
724 @vindex ediff-display-help-hook | |
725 Ediff runs this hook each time after setting up the help message. It | |
726 can be used to alter the help message for custom packages that run on | |
727 top of Ediff. | |
728 | |
729 @item ediff-mode-hook | |
730 @vindex ediff-mode-hook | |
731 This hook is run just after Ediff mode is set up in the control | |
732 buffer. This is done before any Ediff window is created. You can use it to | |
733 set local variables that alter the look of the display. | |
734 | |
735 @item ediff-registry-setup-hook | |
736 @vindex ediff-registry-setup-hook | |
737 Hooks run after setting up the registry for all active Ediff session. | |
738 @xref{Session Groups}, for details. | |
739 @item ediff-session-group-setup-hook | |
740 @vindex ediff-session-group-setup-hook | |
741 Hooks run after setting up a control panel for a group of related Ediff | |
742 sessions. @xref{Session Groups}, for details. | |
743 @end table | |
744 | |
745 @node Quick Help, Window and Frame Configuration, Hooks, Customization | |
746 @section Quick Help | |
747 @vindex ediff-use-long-help-message | |
748 @vindex ediff-control-buffer | |
749 @vindex ediff-startup-hook | |
750 @vindex ediff-help-message | |
751 | |
752 Ediff provides quick help using its control panel window. Since this window | |
753 takes a fair share of the screen real estate, you can toggle it off by | |
754 typing @kbd{?}. The control window will then shrink to just one line and a | |
755 mode line, displaying a short help message. | |
756 | |
757 The variable @code{ediff-use-long-help-message} tells Ediff whether | |
758 you use the short message or the long one. By default, it | |
759 is set to @code{nil}, meaning that the short message is used. | |
760 Set this to @code{t}, if you want Ediff to use the long | |
761 message by default. This property can always be changed interactively, by | |
762 typing @kbd{?} into Ediff Control Buffer. | |
763 | |
764 If you want to change the appearance of the help message on a per-buffer | |
765 basis, you must use @code{ediff-startup-hook} to change the value of | |
766 the variable @code{ediff-help-message}, which is local to | |
767 @code{ediff-control-buffer}. | |
768 | |
769 @node Window and Frame Configuration, Selective Browsing, Quick Help, Customization | |
770 @section Window and Frame Configuration | |
771 | |
772 On a non-windowing display, Ediff sets things up in one frame, splitting | |
773 it between a small control window and the windows for buffers A, B, and C. | |
774 The split between these windows can be horizontal or | |
775 vertical, which can be changed interactively by typing @kbd{|} while the | |
776 cursor is in the control window. | |
777 | |
778 On a window display, Ediff sets up a dedicated frame for Ediff Control | |
779 Panel and then it chooses windows as follows: If one of the buffers | |
780 is invisible, it is displayed in the currently selected frame. If | |
781 a buffer is visible, it is displayed in the frame where it is visible. | |
782 If, according to the above criteria, the two buffers fall into the same | |
783 frame, then so be it---the frame will be shared by the two. The same | |
784 algorithm works when you type @kbd{C-l} (@code{ediff-recenter}), @kbd{p} | |
785 (@code{ediff-previous-difference}), @kbd{n} | |
786 (@code{ediff-next-difference}), etc. | |
787 | |
788 The above behavior also depends on whether the current frame is splittable, | |
789 dedicated, etc. Unfortunately, the margin is too small to present this | |
790 remarkable algorithm. | |
791 | |
792 The bottom line of all this is that you can compare buffers in one frame or | |
793 in different frames. The former is done by default, while the latter can | |
794 be achieved by arranging buffers A, B (and C, if applicable) to be seen in | |
795 different frames. Ediff respects these arrangements, automatically | |
796 adapting itself to the multi-frame mode. | |
797 | |
798 Ediff uses the following variables to set up its control panel | |
799 (a.k.a. control buffer, a.k.a. quick help window): | |
800 | |
801 @table @code | |
802 @item ediff-control-frame-parameters | |
803 @vindex ediff-control-frame-parameters | |
804 You can change or augment this variable including the font, color, | |
805 etc. The X resource name of Ediff Control Panel frames is @samp{Ediff}. Under | |
806 X-windows, you can use this name to set up preferences in your | |
807 @file{~/.Xdefaults}, @file{~/.xrdb}, or whatever X resource file is in | |
808 use. Usually this is preferable to changing | |
809 @code{ediff-control-frame-parameters} directly. For instance, you can | |
810 specify in @file{~/.Xdefaults} the color of the control frame | |
811 using the resource @samp{Ediff*background}. | |
812 | |
813 In general, any X resource pertaining the control frame can be reached | |
814 via the prefix @code{Ediff*}. | |
815 | |
816 @item ediff-control-frame-position-function | |
817 @vindex ediff-control-frame-position-function | |
818 The preferred way of specifying the position of the control frame is by | |
819 setting the variable @code{ediff-control-frame-position-function} to an | |
820 appropriate function. | |
821 The default value of this variable is | |
822 @code{ediff-make-frame-position}. This function places the control frame in | |
823 the vicinity of the North-East corner of the frame displaying buffer A. | |
824 | |
825 @findex ediff-make-frame-position | |
826 @end table | |
827 | |
828 The following variables can be used to adjust the location produced by | |
829 @code{ediff-make-frame-position} and for related customization. | |
830 | |
831 @table @code | |
832 @item ediff-narrow-control-frame-leftward-shift | |
833 @vindex ediff-narrow-control-frame-leftward-shift | |
834 Specifies the number of characters for shifting | |
835 the control frame from the rightmost edge of frame A when the control | |
836 frame is displayed as a small window. | |
837 | |
838 @item ediff-wide-control-frame-rightward-shift | |
839 @vindex ediff-wide-control-frame-rightward-shift | |
840 Specifies the rightward shift of the control frame | |
841 from the left edge of frame A when the control frame shows the full | |
842 menu of options. | |
843 | |
844 @item ediff-control-frame-upward-shift | |
845 @vindex ediff-control-frame-upward-shift | |
846 Specifies the number of pixels for the upward shift | |
847 of the control frame. | |
848 | |
849 @item ediff-prefer-iconified-control-frame | |
850 @vindex ediff-prefer-iconified-control-frame | |
851 If this variable is @code{t}, the control frame becomes iconified | |
852 automatically when you toggle the quick help message off. This saves | |
853 valuable real estate on the screen. Toggling help back will deiconify | |
854 the control frame. | |
855 | |
856 To start Ediff with an iconified Control Panel, you should set this | |
857 variable to @code{t} and @code{ediff-prefer-long-help-message} to | |
858 @code{nil} (@pxref{Quick Help}). This behavior is useful only if the | |
859 window manager is TWM or a derivative. Also, this doesn't work under | |
860 XEmacs, since this editor ignores input from icons. | |
861 @end table | |
862 | |
863 @findex ediff-setup-windows | |
864 To make more creative changes in the way Ediff sets up windows, you can | |
865 rewrite the function @code{ediff-setup-windows}. However, we believe | |
866 that detaching Ediff Control Panel from the rest and making it into a | |
867 separate frame offers an important opportunity by allowing you to | |
868 iconify that frame. Under Emacs, the icon will usually accept all of | |
869 the Ediff commands, but will free up valuable real estate on your screen | |
870 (this may depend on the window manager, though). Iconifying won't do | |
871 any good under XEmacs since XEmacs icons are not sensitive to keyboard | |
872 input. The saving grace is that, even if not iconified, the control | |
873 frame is very small, smaller than some icons, so it does not take much | |
874 space in any case. | |
875 | |
876 The following variable controls how windows are set up: | |
877 | |
878 @table @code | |
879 @item ediff-window-setup-function | |
880 @vindex ediff-window-setup-function | |
881 The multiframe setup is done by the | |
882 @code{ediff-setup-windows-multiframe} function, which is the default on | |
883 windowing displays. The plain setup, one where all windows are always | |
884 in one frame, is done by @code{ediff-setup-windows-plain}, which is the | |
885 default on a non-windowing display (or in an xterm window). In fact, | |
886 under Emacs, you can switch freely between these two setups by executing | |
887 the command @code{ediff-toggle-multiframe} using the Minibuffer. | |
888 @findex ediff-setup-windows-multiframe | |
889 @findex ediff-setup-windows-plain | |
890 @findex ediff-toggle-multiframe | |
891 | |
892 If you don't like any of these setups, write your own function. See the | |
893 documentation for @code{ediff-window-setup-function} for the basic | |
894 guidelines. However, writing window setups is not easy, so you should | |
895 first take a close look at @code{ediff-setup-windows-plain} and | |
896 @code{ediff-setup-windows-multiframe}. | |
897 @end table | |
898 | |
899 You can run multiple Ediff sessions at once, by invoking Ediff several | |
900 times without exiting previous Ediff sessions. Different sessions | |
901 may even operate on the same pair of files. | |
902 | |
903 Each session has its own Ediff Control Panel and all the regarding a | |
904 particular session is local to the associated control panel buffer. You | |
905 can switch between sessions by suspending one session and then switching | |
906 to another control panel. (Different control panel buffers are | |
907 distinguished by a numerical suffix, e.g., @samp{Ediff Control Panel<3>}.) | |
908 | |
909 @node Selective Browsing, Highlighting Difference Regions, Window and Frame Configuration, Customization | |
910 @section Selective Browsing | |
911 | |
912 Sometimes it is convenient to be able to step through only some difference | |
913 regions, those that satisfy certain regular expressions, and to ignore all | |
914 others. On other occasions, you may want to ignore difference regions that | |
915 satisfy some regular expressions, and to look only at the rest. | |
916 | |
917 The commands @kbd{#f} and @kbd{#h} let you do precisely this. | |
918 | |
919 Typing @kbd{#f} lets you specify regular expressions that match difference | |
920 regions you want to focus on. | |
921 We shall call these regular expressions @var{regexp-A}, @var{regexp-B} and | |
922 @var{regexp-C}. | |
923 Ediff will then start stepping through only those difference regions | |
924 where the region in buffer A matches @var{regexp-A} and/or the region in | |
925 buffer B matches @var{regexp-B}, etc. Whether `and' or `or' will be used | |
926 depends on how you respond to a question. | |
927 | |
928 When scanning difference regions for the aforesaid regular expressions, | |
929 Ediff narrows the buffers to those regions. This means that you can use | |
930 the expressions @kbd{\`} and @kbd{\'} to tie search to the beginning or end | |
931 of the difference regions. | |
932 | |
933 On the other hand, typing @kbd{#h} lets you specify (hide) uninteresting | |
934 regions. That is, if a difference region in buffer A matches | |
935 @var{regexp-A}, the corresponding region in buffer B matches @var{regexp-B} | |
936 and (if applicable) buffer-C's region matches @var{regexp-C}, then the | |
937 region will be ignored by the commands @kbd{n}/@key{SPC} | |
938 (@code{ediff-next-difference}) and @kbd{p}/@key{DEL} | |
939 (@code{ediff-previous-difference}) commands. | |
940 | |
941 Typing @kbd{#f} and @kbd{#h} toggles selective browsing on and off. | |
942 | |
943 Note that selective browsing affects only @code{ediff-next-difference} | |
944 and @code{ediff-previous-difference}, i.e., the commands | |
945 @kbd{n}/@key{SPC} and @kbd{p}/@key{DEL}. @kbd{#f} and @kbd{#h} do not | |
946 change the position of the point in the buffers. And you can still jump | |
947 directly (using @kbd{j}) to any numbered | |
948 difference. | |
949 | |
950 Users can supply their own functions to specify how Ediff should do | |
951 selective browsing. To change the default Ediff function, add a function to | |
952 @code{ediff-load-hook} which will do the following assignments: | |
953 | |
954 @example | |
955 (setq ediff-hide-regexp-matches-function 'your-hide-function) | |
956 (setq ediff-focus-on-regexp-matches-function 'your-focus-function) | |
957 @end example | |
958 | |
959 @strong{Useful hint}: To specify a regexp that matches everything, don't | |
960 simply type @key{RET} in response to a prompt. Typing @key{RET} tells Ediff | |
961 to accept the default value, which may not be what you want. Instead, you | |
962 should enter something like @key{^} or @key{$}. These match every | |
963 line. | |
964 | |
965 You can use the status command, @kbd{i}, to find out whether | |
966 selective browsing is currently in use. | |
967 | |
968 The regular expressions you specified are kept in the local variables | |
969 @code{ediff-regexp-focus-A}, @code{ediff-regexp-focus-B}, | |
970 @code{ediff-regexp-focus-C}, @code{ediff-regexp-hide-A}, | |
971 @code{ediff-regexp-hide-B}, @code{ediff-regexp-hide-C}. Their default value | |
972 is the empty string (i.e., nothing is hidden or focused on). To change the | |
973 default, set these variables in @file{.emacs} using @code{setq-default}. | |
974 | |
975 In addition to the ability to ignore regions that match regular | |
976 expressions, Ediff can be ordered to start skipping over certain | |
977 ``inessential'' regions. This is controlled by the following variable: | |
978 | |
979 @table @code | |
980 @item ediff-ignore-similar-regions | |
981 @vindex ediff-ignore-similar-regions | |
982 If @code{t}, causes Ediff to skip over difference regions | |
983 that deemed inessential, i.e., where the only differences are those | |
984 in the white space and newlines. | |
985 @end table | |
986 | |
987 @strong{Note:} In order for this feature to work, auto-refining of | |
988 difference regions must be on, since otherwise Ediff won't know if there | |
989 are fine differences between regions. On devices where Emacs can display | |
990 faces, auto-refining is a default, but it is not turned on by default on | |
991 text-only terminals. In that case, you must explicitly turn auto-refining | |
992 on (such as, by typing @kbd{@@}). | |
993 | |
994 @strong{Reassurance:} If many inessential regions appear in a row, Ediff may | |
995 take a long time to jump to the next region because it has to compute | |
996 fine differences of all intermediate regions. This delay does not | |
997 indicate any problem. | |
998 | |
999 @node Highlighting Difference Regions, Narrowing, Selective Browsing, Customization | |
1000 @section Highlighting Difference Regions | |
1001 | |
1002 The following variables control the way Ediff highlights difference | |
1003 regions: | |
1004 | |
1005 @table @code | |
1006 @item ediff-before-flag-bol | |
1007 @itemx ediff-after-flag-eol | |
1008 @itemx ediff-before-flag-mol | |
1009 @itemx ediff-after-flag-mol | |
1010 @vindex ediff-before-flag-bol | |
1011 @vindex ediff-after-flag-eol | |
1012 @vindex ediff-before-flag-mol | |
1013 @vindex ediff-after-flag-mol | |
1014 These variables hold strings that Ediff uses to mark the beginning and the | |
1015 end of the differences found in files A, B, and C on devices where Emacs | |
1016 cannot display faces. Ediff uses different flags to highlight regions that | |
1017 begin/end at the beginning/end of a line or in a middle of a line. | |
1018 | |
1019 @item ediff-current-diff-face-A | |
1020 @itemx ediff-current-diff-face-B | |
1021 @itemx ediff-current-diff-face-C | |
1022 @vindex ediff-current-diff-face-A | |
1023 @vindex ediff-current-diff-face-B | |
1024 @vindex ediff-current-diff-face-C | |
1025 Ediff uses these faces to highlight current differences on devices where | |
1026 Emacs can display faces. These and subsequently described faces can be set | |
1027 either in @file{.emacs} or in @file{.Xdefaults}. The X resource for Ediff | |
1028 is @samp{Ediff}, @emph{not} @samp{emacs}. Please refer to Emacs manual for | |
1029 the information on how to set X resources. | |
1030 @item ediff-fine-diff-face-A | |
1031 @itemx ediff-fine-diff-face-B | |
1032 @itemx ediff-fine-diff-face-C | |
1033 @vindex ediff-fine-diff-face-A | |
1034 @vindex ediff-fine-diff-face-B | |
1035 @vindex ediff-fine-diff-face-C | |
1036 Ediff uses these faces to show the fine differences between the current | |
1037 differences regions in buffers A, B, and C, respectively. | |
1038 | |
1039 @item ediff-even-diff-face-A | |
1040 @itemx ediff-even-diff-face-B | |
1041 @itemx ediff-even-diff-face-C | |
1042 @itemx ediff-odd-diff-face-A | |
1043 @itemx ediff-odd-diff-face-B | |
1044 @itemx ediff-odd-diff-face-C | |
1045 @vindex ediff-even-diff-face-A | |
1046 @vindex ediff-even-diff-face-B | |
1047 @vindex ediff-even-diff-face-C | |
1048 @vindex ediff-odd-diff-face-A | |
1049 @vindex ediff-odd-diff-face-B | |
1050 @vindex ediff-odd-diff-face-C | |
1051 Non-current difference regions are displayed using these alternating | |
1052 faces. The odd and the even faces are actually identical on monochrome | |
1053 displays, because without colors options are limited. | |
1054 So, Ediff uses italics to highlight non-current differences. | |
1055 | |
1056 @item ediff-force-faces | |
1057 @vindex ediff-force-faces | |
1058 Ediff generally can detect when Emacs is running on a device where it can | |
1059 use highlighting with faces. However, if it fails to determine that faces | |
1060 can be used, the user can set this variable to @code{t} to make sure that | |
1061 Ediff uses faces to highlight differences. | |
1062 | |
1063 @item ediff-highlight-all-diffs | |
1064 @vindex ediff-highlight-all-diffs | |
1065 Indicates whether---on a window system---Ediff should highlight differences | |
1066 using inserted strings (as on a text-only terminal) or using colors and | |
1067 highlighting. Normally, Ediff highlights all differences, but the | |
1068 selected difference is highlighted more visibly. One can cycle through | |
1069 various modes of highlighting by typing @kbd{h}. By default, Ediff | |
1070 starts in the mode where all difference regions are highlighted. If you | |
1071 prefer to start in the mode where unselected differences are not | |
1072 highlighted, you should set @code{ediff-highlight-all-diffs} to | |
1073 @code{nil}. Type @kbd{h} to restore highlighting of all differences. | |
1074 | |
1075 Ediff lets you switch between the two modes of highlighting. That is, | |
1076 you can switch interactively from highlighting using faces to | |
1077 highlighting using string flags, and back. Of course, switching has | |
1078 effect only under a windowing system. On a text-only terminal or in an | |
1079 xterm window, the only available option is highlighting with strings. | |
1080 @end table | |
1081 | |
1082 @noindent | |
1083 If you want to change the above variables, you must do it | |
1084 @strong{before} Ediff is loaded. | |
1085 | |
1086 There are two ways to change the default setting | |
1087 for highlighting faces: either change the variables, as shown here, | |
1088 | |
1089 @example | |
1090 (setq ediff-current-diff-face-A 'bold-italic) | |
1091 @end example | |
1092 | |
1093 @noindent | |
1094 or here, | |
1095 | |
1096 @example | |
1097 (setq ediff-current-diff-face-A | |
1098 (copy-face 'bold-italic 'ediff-current-diff-face-A)) | |
1099 @end example | |
1100 | |
1101 @noindent | |
1102 or modify the defaults selectively: | |
1103 | |
1104 @smallexample | |
1105 (add-hook 'ediff-load-hook | |
1106 (function (lambda () | |
1107 (set-face-foreground | |
1108 ediff-current-diff-face-B "blue") | |
1109 (set-face-background | |
1110 ediff-current-diff-face-B "red") | |
1111 (make-face-italic | |
1112 ediff-current-diff-face-B)))) | |
1113 @end smallexample | |
1114 | |
1115 You may also want to take a look at how the above faces are defined in the | |
1116 source code of Ediff. | |
1117 | |
1118 @strong{Note:} it is not recommended to use @code{internal-get-face} (or | |
1119 @code{get-face} in XEmacs) when defining Ediff's faces, since this may | |
1120 cause problems when there are several frames with different font sizes. | |
1121 Instead, use @code{copy-face} or @code{set/make-face-@dots{}} as shown | |
1122 above. | |
1123 | |
1124 @node Narrowing, Refinement of Difference Regions, Highlighting Difference Regions, Customization | |
1125 @section Narrowing | |
1126 | |
1127 If buffers being compared are narrowed at the time of invocation of | |
1128 Ediff, @code{ediff-buffers} will preserve the narrowing range. However, | |
1129 if @code{ediff-files} is invoked on the files visited by these buffers, | |
1130 that widens the buffers, since this command is defined to compare the | |
1131 entire files. | |
1132 | |
1133 Calling @code{ediff-regions-linewise} or @code{ediff-windows-linewise}, | |
1134 or the corresponding @samp{-wordwise} commands, narrows the buffers | |
1135 being compared (corresponding to the regions being compared). The | |
1136 original accessible ranges are restored when you quit Ediff. | |
1137 During the command, you can toggle this narrowing on and off | |
1138 with the @kbd{%} command. | |
1139 | |
1140 These two variables control this narrowing behavior: | |
1141 | |
1142 @table @code | |
1143 @item ediff-start-narrowed | |
1144 @vindex ediff-start-narrowed | |
1145 If @code{t}, Ediff narrows the display to the appropriate range when it | |
1146 is invoked with an @samp{ediff-regions@dots{}} or | |
1147 @samp{ediff-windows@dots{}} command. If @code{nil}, these commands do | |
1148 not automatically narrow, but you can still toggle narrowing on and off | |
1149 by typing @kbd{%}. | |
1150 | |
1151 @item ediff-quit-widened | |
1152 @vindex ediff-quit-widened | |
1153 Controls whether on quitting Ediff should restore the accessible range | |
1154 that existed before the current invocation. | |
1155 @end table | |
1156 | |
1157 @node Refinement of Difference Regions, Patch and Diff Programs, Narrowing, Customization | |
1158 @section Refinement of Difference Regions | |
1159 | |
1160 Ediff has variables to control the way fine differences are | |
1161 highlighted. This feature gives you control over the process of refinement. | |
1162 Note that refinement ignores spaces, tabs, and newlines. | |
1163 | |
1164 @table @code | |
1165 @item ediff-auto-refine | |
1166 @vindex ediff-auto-refine | |
1167 This variable controls whether fine differences within regions are | |
1168 highlighted automatically (``auto-refining''). The default is yes | |
1169 (@samp{on}). | |
1170 | |
1171 On a slow machine, automatic refinement may be painful. In that case, | |
1172 you can turn auto-refining on or off interactively by typing | |
1173 @kbd{@@}. You can also turn off display of refining that has | |
1174 already been done. | |
1175 | |
1176 When auto-refining is off, fine differences are shown only for regions | |
1177 for which these differences have been computed and saved before. If | |
1178 auto-refining and display of refining are both turned off, fine | |
1179 differences are not shown at all. | |
1180 | |
1181 Typing @kbd{*} computes and displays fine differences for the current | |
1182 difference region, regardless of whether auto-refining is turned on. | |
1183 | |
1184 @item ediff-auto-refine-limit | |
1185 @vindex ediff-auto-refine-limit | |
1186 If auto-refining is on, this variable limits the size of the regions to | |
1187 be auto-refined. This guards against the possible slowdown that may be | |
1188 caused by extraordinary large difference regions. | |
1189 | |
1190 You can always refine the current region by typing @kbd{*}. | |
1191 | |
1192 @item ediff-forward-word-function | |
1193 @vindex ediff-forward-word-function | |
1194 This variable gives control over how fine differences are computed. The | |
1195 value must be a Lisp function that determines how the current difference | |
1196 region should be split into words. | |
1197 | |
1198 @vindex ediff-diff-program | |
1199 @vindex ediff-forward-word-function | |
1200 @findex ediff-forward-word | |
1201 Fine differences are computed by first splitting the current difference | |
1202 region into words and then passing this along to | |
1203 @code{ediff-diff-program}. For the default | |
1204 @code{ediff-forward-word-function} (which is @code{ediff-forward-word}), a | |
1205 word is a string consisting of letters, @samp{-}, or @samp{_}; a string of | |
1206 punctuation symbols; a string of digits, or a string consisting of symbols | |
1207 that are neither space, nor a letter. | |
1208 | |
1209 This default behavior is controlled by four variables: @code{ediff-word-1}, | |
1210 ..., @code{ediff-word-4}. See the on-line documentation for these variables | |
1211 and for the function @code{ediff-forward-word} for an explanation of how to | |
1212 modify these variables. | |
1213 @vindex ediff-word-1 | |
1214 @vindex ediff-word-2 | |
1215 @vindex ediff-word-3 | |
1216 @vindex ediff-word-4 | |
1217 @end table | |
1218 | |
1219 Sometimes, when a region has too many differences between the variants, | |
1220 highlighting of fine differences is inconvenient, especially on | |
1221 color displays. If that is the case, type @kbd{*} with a negative | |
1222 prefix argument. This unhighlights fine differences for the current | |
1223 region. | |
1224 | |
1225 To unhighlight fine differences in all difference regions, use the | |
1226 command @kbd{@@}. Repeated typing of this key cycles through three | |
1227 different states: auto-refining, no-auto-refining, and no-highlighting | |
1228 of fine differences. | |
1229 | |
1230 @node Patch and Diff Programs, Merging and diff3, Refinement of Difference Regions, Customization | |
1231 @section Patch and Diff Programs | |
1232 | |
1233 This section describes variables that specify the programs to be used for | |
1234 applying patches and for computing the main difference regions (not the | |
1235 fine difference regions): | |
1236 | |
1237 @table @code | |
1238 @item ediff-patch-program | |
1239 @itemx ediff-diff-program | |
1240 @itemx ediff-diff3-program | |
1241 @vindex ediff-patch-program | |
1242 @vindex ediff-diff-program | |
1243 @vindex ediff-diff3-program | |
1244 These variables specify the programs to use to produce differences | |
1245 and do patching. | |
1246 | |
1247 @item ediff-patch-options | |
1248 @itemx ediff-diff-options | |
1249 @itemx ediff-diff3-options | |
1250 @vindex ediff-patch-options | |
1251 @vindex ediff-diff-options | |
1252 @vindex ediff-diff3-options | |
1253 These variables specify the options to pass to the above utilities. | |
1254 | |
1255 In @code{ediff-diff-options}, it may be useful to specify options | |
1256 such as @samp{-w} that ignore certain kinds of changes. However, | |
1257 Ediff does not let you use the option @samp{-c}, as it doesn't recognize this | |
1258 format yet. | |
1259 | |
1260 | |
1261 @item ediff-custom-diff-program | |
1262 @itemx ediff-custom-diff-options | |
1263 @vindex ediff-custom-diff-program | |
1264 @vindex ediff-custom-diff-options | |
1265 @findex ediff-save-buffer | |
1266 Because Ediff limits the options you may want to pass to the @code{diff} | |
1267 program, it partially makes up for this drawback by letting you save the | |
1268 output from @code{diff} in your preferred format, which is specified via | |
1269 the above two variables. | |
1270 | |
1271 The output generated by @code{ediff-custom-diff-program} (which doesn't | |
1272 even have to be a standard-style @file{diff}!) is not used by Ediff. It is | |
1273 provided exclusively so that you can | |
1274 refer to | |
1275 it later, send it over email, etc. For instance, after reviewing the | |
1276 differences, you may want to send context differences to a colleague. | |
1277 Since Ediff ignores the @samp{-c} option in | |
1278 @code{ediff-diff-program}, you would have to run @code{diff -c} separately | |
1279 just to produce the list of differences. Fortunately, | |
1280 @code{ediff-custom-diff-program} and @code{ediff-custom-diff-options} | |
1281 eliminate this nuisance by keeping a copy of a difference list in the | |
1282 desired format in a buffer that can be displayed via the command @kbd{D}. | |
1283 | |
1284 @item ediff-patch-default-directory | |
1285 @vindex ediff-patch-default-directory | |
1286 Specifies the default directory to look for patches. | |
1287 | |
1288 @end table | |
1289 | |
1290 @noindent | |
1291 @strong{Warning:} Ediff does not support the output format of VMS | |
1292 @code{diff}. Instead, make sure to use some implementation of POSIX | |
1293 @code{diff}, such as @code{gnudiff}. | |
1294 | |
1295 @node Merging and diff3, Support for Version Control, Patch and Diff Programs, Customization | |
1296 @section Merging and diff3 | |
1297 | |
1298 Ediff supports three-way comparison via the functions @code{ediff-files3} and | |
1299 @code{ediff-buffers3}. The interface is the same as for two-way comparison. | |
1300 In three-way comparison and merging, Ediff reports if any two difference | |
1301 regions are identical. For instance, if the current region in buffer A | |
1302 is the same as the region in buffer C, then the mode line of buffer A will | |
1303 display @samp{[=diff(C)]} and the mode line of buffer C will display | |
1304 @samp{[=diff(A)]}. | |
1305 | |
1306 Merging is done according to the following algorithm. | |
1307 | |
1308 If a difference region in one of the buffers, say B, differs from the ancestor | |
1309 file while the region in the other buffer, A, doesn't, then the merge buffer, | |
1310 C, gets B's region. Similarly when buffer A's region differs from | |
1311 the ancestor and B's doesn't, A's region is used. | |
1312 | |
1313 @vindex ediff-default-variant | |
1314 If both regions in buffers A and B differ from the ancestor file, Ediff | |
1315 chooses the region according to the value of the variable | |
1316 @code{ediff-default-variant}. If its value is @code{default-A} then A's | |
1317 region is chosen. If it is @code{default-B} then B's region is chosen. | |
1318 If it is @code{combined} then the region in buffer C will look like | |
1319 this: | |
1320 | |
1321 @example | |
1322 #ifdef NEW /* variant A */ | |
1323 difference region from buffer A | |
1324 #else /* variant B */ | |
1325 difference region from buffer B | |
1326 #endif /* NEW */ | |
1327 @end example | |
1328 | |
1329 @vindex ediff-combination-pattern | |
1330 The actual strings that separate the regions copied from buffer A and B | |
1331 are controlled by the variable @code{ediff-combination-pattern}. Its | |
1332 value should be a list of three strings. The first is inserted before | |
1333 the difference region of buffer A; the second string goes between the | |
1334 regions; the third goes after region B, as shown in the above example. | |
1335 | |
1336 In addition to the state of the difference, during merging Ediff | |
1337 displays the state of the merge for each region. If a difference came | |
1338 from buffer A by default (because both regions A and B were different | |
1339 from the ancestor and @code{ediff-default-variant} was set to @code{default-A}) | |
1340 then @samp{[=diff(A) default-A]} is displayed in the mode line. If the | |
1341 difference in buffer C came, say, from buffer B because the difference region | |
1342 in that buffer differs from the ancestor, but the region in buffer A | |
1343 does not (if merging with an ancestor) then @samp{[=diff(B) prefer-B]} is | |
1344 displayed. The indicators default-A/B and prefer-A/B are inspired by | |
1345 Emerge and have the same meaning. | |
1346 | |
1347 Another indicator of the state of merge is @samp{combined}. It appears | |
1348 with any difference region in buffer C that was obtained by combining | |
1349 the difference regions in buffers A and B as explained above. | |
1350 | |
1351 In addition to state of merge and difference indicator, while merging with an | |
1352 ancestor file or buffer, Ediff informs the user when the current difference | |
1353 region in the (normally invisible) ancestor buffer is empty via the | |
1354 @emph{AncestorEmpty} indicator. This helps determine if the changes | |
1355 made to the original in variants A and B represent pure insertion or | |
1356 deletion of text: if the mode line shows @emph{AncestorEmpty} and the | |
1357 corresponding region in buffers A or B is not empty, this means that new | |
1358 text was inserted. If this indicator is not present and the difference | |
1359 regions in buffers A or B are non-empty, this means that text was | |
1360 modified. Otherwise, the original text was deleted. | |
1361 | |
1362 Although the ancestor buffer is normally invisible, Ediff maintains | |
1363 difference regions there and advances the current difference region | |
1364 accordingly. All highlighting of difference regions is provided in the | |
1365 ancestor buffer, except for the fine differences. Therefore, if desired, the | |
1366 user can put the ancestor buffer in a separate frame and watch it | |
1367 there. However, on a TTY, only one frame can be visible at any given time, | |
1368 and Ediff doesn't support any single-frame window configuration where all | |
1369 buffers, including the ancestor buffer, would be visible. However, the | |
1370 ancestor buffer can be displayed by typing @kbd{/} to the control | |
1371 window. (Type @kbd{C-l} to hide it again.) | |
1372 | |
1373 Note that the state-of-difference indicators @samp{=diff(A)} and | |
1374 @samp{=diff(B)} above are not redundant, even in the presence of a | |
1375 state-of-merge indicator. In fact, the two serve different purposes. | |
1376 | |
1377 For instance, if the mode line displays @samp{=diff(B) prefer(B)} and | |
1378 you copy a difference region from buffer A to buffer C then | |
1379 @samp{=diff(B)} will change to @samp{diff-A} and the mode line will | |
1380 display @samp{=diff(A) prefer-B}. This indicates that the difference | |
1381 region in buffer C is identical to that in buffer A, but originally | |
1382 buffer C's region came from buffer B. This is useful to know because | |
1383 you can recover the original difference region in buffer C by typing | |
1384 @kbd{r}. | |
1385 | |
1386 | |
1387 Ediff never changes the state-of-merge indicator, except in response to | |
1388 the @kbd{!} command (see below), in which case the indicator is lost. | |
1389 On the other hand, the state-of-difference indicator is changed | |
1390 automatically by the copying/recovery commands, @kbd{a}, @kbd{b}, @kbd{r}, | |
1391 @kbd{+}. | |
1392 | |
1393 The @kbd{!} command loses the information about origins of the regions | |
1394 in the merge buffer (default-A, prefer-B, or combined). This is because | |
1395 recomputing differences in this case means running @code{diff3} on | |
1396 buffers A, B, and the merge buffer, not on the ancestor buffer. (It | |
1397 makes no sense to recompute differences using the ancestor file, since | |
1398 in the merging mode Ediff assumes that you have not edited buffers A and | |
1399 B, but that you may have edited buffer C, and these changes are to be | |
1400 preserved.) Since some difference regions may disappear as a result of | |
1401 editing buffer C and others may arise, there is generally no simple way | |
1402 to tell where the various regions in the merge buffer came from. | |
1403 | |
1404 In three-way comparison, Ediff tries to disregard regions that consist | |
1405 entirely of white space. For instance, if, say, the current region in | |
1406 buffer A consists of the white space only (or if it is empty), Ediff will | |
1407 not take it into account for the purpose of computing fine differences. The | |
1408 result is that Ediff can provide a better visual information regarding the | |
1409 actual fine differences in the non-white regions in buffers B and | |
1410 C. Moreover, if the regions in buffers B and C differ in the white space | |
1411 only, then a message to this effect will be displayed. | |
1412 | |
1413 @vindex ediff-merge-window-share | |
1414 In the merge mode, the share of the split between window C (the window | |
1415 displaying the merge-buffer) and the windows displaying buffers A and B | |
1416 is controlled by the variable @code{ediff-merge-window-share}. Its | |
1417 default value is 0.5. To make the merge-buffer window smaller, reduce | |
1418 this amount. | |
1419 | |
1420 We don't recommend increasing the size of the merge-window to more than | |
1421 half the frame (i.e., to increase the value of | |
1422 @code{ediff-merge-window-share}) to more than 0.5, since it would be | |
1423 hard to see the contents of buffers A and B. | |
1424 | |
1425 You can temporarily shrink the merge window to just one line by | |
1426 typing @kbd{s}. This change is temporary, until Ediff finds a reason to | |
1427 redraw the screen. Typing @kbd{s} again restores the original window size. | |
1428 | |
1429 With a positive prefix argument, the @kbd{s} command will make the merge | |
1430 window slightly taller. This change is persistent. With `@kbd{-}' or | |
1431 with a negative prefix argument, the command @kbd{s} makes the merge | |
1432 window slightly shorter. This change also persistent. | |
1433 | |
1434 @vindex ediff-show-clashes-only | |
1435 Ediff lets you automatically ignore the regions where only one of the | |
1436 buffers A and B disagrees with the ancestor. To do this, set the | |
1437 variable @code{ediff-show-clashes-only} to non-@code{nil}. | |
1438 | |
1439 You can toggle this feature interactively by typing @kbd{$}. | |
1440 | |
1441 Note that this variable controls only how Ediff chooses the | |
1442 next/previous difference to show. You can still jump directly to any | |
1443 difference using the command @kbd{j} (with a prefix argument specifying | |
1444 the difference number). | |
1445 | |
1446 @node Support for Version Control, Customizing the Mode Line, Merging and diff3, Customization | |
1447 @section Support for Version Control | |
1448 | |
1449 | |
1450 Ediff supports version control and lets you compare versions of files | |
1451 visited by Emacs buffers via the function @code{ediff-revision}. This | |
1452 feature is controlled by the following variables: | |
1453 | |
1454 @table @code | |
1455 @item ediff-version-control-package | |
1456 @vindex ediff-version-control-package | |
1457 A symbol. The default is @samp{vc}. | |
1458 | |
1459 If you are like most Emacs users, Ediff will use VC as the version control | |
1460 package. This is the standard Emacs interface to RCS, CVS, and SCCS. | |
1461 | |
1462 However, if your needs are better served by other interfaces, you will | |
1463 have to tell Ediff which version control package you are using, e.g., | |
1464 @example | |
1465 (setq ediff-version-control-package 'rcs) | |
1466 @end example | |
1467 | |
1468 Apart from the standard @file{vc.el}, Ediff supports three other interfaces | |
1469 to version control: | |
1470 @file{rcs.el}, @file{pcl-cvs.el}, and @file{generic-sc.el}. | |
1471 The package @file{rcs.el} is written by Sebastian Kremer | |
1472 <sk@@thp.Uni-Koeln.DE> and is available as | |
1473 @example | |
1474 @file{ftp.cs.buffalo.edu:pub/Emacs/rcs.tar.Z} | |
1475 @file{ftp.uni-koeln.de:/pub/gnu/emacs/rcs.tar.Z} | |
1476 @end example | |
1477 The packages @file{pcl-cvs.el} and @file{generic-sc.el} are found in XEmacs | |
1478 distribution. | |
1479 @pindex @file{vc.el} | |
1480 @pindex @file{rcs.el} | |
1481 @pindex @file{pcl-cvs.el} | |
1482 @pindex @file{generic-sc.el} | |
1483 @end table | |
1484 | |
1485 Ediff's interface to the above packages allows the user to compare the | |
1486 versions of the current buffer or to merge them (with or without an | |
1487 ancestor-version). These operations can also be performed on directories | |
1488 containing files under version control. | |
1489 | |
1490 In case of @file{pcl-cvs.el}, Ediff can also be invoked via the function | |
1491 @code{run-ediff-from-cvs-buffer}---see the documentation string for this | |
1492 function. | |
1493 | |
1494 @node Customizing the Mode Line, Miscellaneous, Support for Version Control, Customization | |
1495 @section Customizing the Mode Line | |
1496 | |
1497 When Ediff is running, the mode line of @samp{Ediff Control Panel} | |
1498 buffer shows the current difference number and the total number of | |
1499 difference regions in the two files. | |
1500 | |
1501 The mode line of the buffers being compared displays the type of the | |
1502 buffer (@samp{A:}, @samp{B:}, or @samp{C:}) and (usually) the file name. | |
1503 Ediff tries to be intelligent in choosing the mode line buffer | |
1504 identification. In particular, it works well with the | |
1505 @file{uniquify.el} and @file{mode-line.el} packages (which improve on | |
1506 the default way in which Emacs displays buffer identification). If you | |
1507 don't like the way Ediff changes the mode line, you can use | |
1508 @code{ediff-prepare-buffer-hook} to modify the mode line. | |
1509 @vindex ediff-prepare-buffer-hook | |
1510 @pindex @file{uniquify.el} | |
1511 @pindex @file{mode-line.el} | |
1512 | |
1513 @node Miscellaneous, Notes on Heavy-duty Customization, Customizing the Mode Line, Customization | |
1514 @section Miscellaneous | |
1515 | |
1516 Here are a few other variables for customizing Ediff: | |
1517 | |
1518 @table @code | |
1519 @item ediff-split-window-function | |
1520 @vindex ediff-split-window-function | |
1521 Controls the way you want the window be split between file-A and file-B | |
1522 (and file-C, if applicable). It defaults to the vertical split | |
1523 (@code{split-window-vertically}, but you can set it to | |
1524 @code{split-window-horizontally}, if you so wish. | |
1525 Ediff also lets you switch from vertical to horizontal split and back | |
1526 interactively. | |
1527 | |
1528 Note that if Ediff detects that all the buffers it compares are displayed in | |
1529 separate frames, it assumes that the user wants them to be so displayed | |
1530 and stops splitting windows. Instead, it arranges for each buffer to | |
1531 be displayed in a separate frame. You can switch to the one-frame mode | |
1532 by hiding one of the buffers A/B/C. | |
1533 | |
1534 You can also swap the windows where buffers are displayed by typing | |
1535 @kbd{~}. | |
1536 | |
1537 @item ediff-merge-split-window-function | |
1538 @vindex ediff-merge-split-window-function | |
1539 Controls how windows are | |
1540 split between buffers A and B in the merge mode. | |
1541 This variable is like @code{ediff-split-window-function}, but it defaults | |
1542 to @code{split-window-horizontally} instead of | |
1543 @code{split-window-vertically}. | |
1544 | |
1545 @item ediff-make-wide-display-function | |
1546 @vindex ediff-make-wide-display-function | |
1547 The value is a function to be called to widen the frame for displaying | |
1548 the Ediff buffers. See the on-line documentation for | |
1549 @code{ediff-make-wide-display-function} for details. It is also | |
1550 recommended to look into the source of the default function | |
1551 @code{ediff-make-wide-display}. | |
1552 | |
1553 You can toggle wide/regular display by typing @kbd{m}. In the wide | |
1554 display mode, buffers A, B (and C, when applicable) are displayed in a | |
1555 single frame that is as wide as the entire workstation screen. This is | |
1556 useful when files are compared side-by-side. By default, the display is | |
1557 widened without changing its height. | |
1558 | |
1559 @item ediff-use-last-dir | |
1560 @vindex ediff-use-last-dir | |
1561 Controls the way Ediff presents the | |
1562 default directory when it prompts the user for files to compare. If | |
1563 @code{nil}, | |
1564 Ediff uses the default directory of the current buffer when it | |
1565 prompts the user for file names. Otherwise, it will use the | |
1566 directories it had previously used for files A, B, or C, respectively. | |
1567 | |
1568 @item ediff-no-emacs-help-in-control-buffer | |
1569 @vindex ediff-no-emacs-help-in-control-buffer | |
1570 If @code{t}, makes @kbd{C-h} | |
1571 behave like the @key{DEL} key, i.e., it will move you back to the previous | |
1572 difference rather than invoking help. This is useful when, in an xterm | |
1573 window or a text-only terminal, the Backspace key is bound to @kbd{C-h} and is | |
1574 positioned more conveniently than the @key{DEL} key. | |
1575 | |
1576 @item ediff-toggle-read-only-function | |
1577 @vindex ediff-toggle-read-only-function | |
1578 This variable's value is a function that Ediff uses to toggle | |
1579 the read-only property in its buffers. | |
1580 | |
1581 The default function that Ediff uses simply toggles the read-only property, | |
1582 unless the file is under version control. For a checked-in file under | |
1583 version control, Ediff first tries to check the file out. | |
1584 | |
1585 @item ediff-keep-variants | |
1586 @vindex @code{ediff-keep-variants} | |
1587 The default is @code{t}, meaning that the buffers being compared or merged will | |
1588 be preserved when Ediff quits. Setting this to @code{nil} causes Ediff to | |
1589 offer the user a chance to delete these buffers (if they are not modified). | |
1590 Supplying a prefix argument to the quit command (@code{q}) temporarily | |
1591 reverses the meaning of this variable. This is convenient when the user | |
1592 prefers one of the behaviors most of the time, but occasionally needs the | |
1593 other behavior. | |
1594 | |
1595 However, Ediff temporarily resets this variable to @code{t} if it is | |
1596 invoked via one of the "buffer" jobs, such as @code{ediff-buffers}. | |
1597 This is because it is all too easy to loose day's work otherwise. | |
1598 Besides, in a "buffer" job, the variant buffers have already been loaded | |
1599 prior to starting Ediff, so Ediff just preserves status quo here. | |
1600 | |
1601 Using @code{ediff-cleanup-hook}, one can make Ediff delete the variants | |
1602 unconditionally (e.g., by making @code{ediff-janitor} into one of these hooks). | |
1603 @item ediff-grab-mouse | |
1604 @vindex @code{ediff-grab-mouse} | |
1605 Default is @code{t}. Normally, Ediff grabs mouse and puts it in its | |
1606 control frame. This is useful since the user can be sure that when he | |
1607 needs to type an Ediff command the focus will be in an appropriate Ediff's | |
1608 frame. However, some users prefer to move the mouse by themselves. The | |
1609 above variable, if set to @code{maybe}, will prevent Ediff from grabbing | |
1610 the mouse in many situations, usually after commands that may take more | |
1611 time than usual. In other situation, Ediff will continue grabbing the mouse | |
1612 and putting it where it believes is appropriate. If the value is | |
1613 @code{nil}, then mouse is entirely user's responsibility. | |
1614 Try different settings and see which one is for you. | |
1615 @end table | |
1616 | |
1617 | |
1618 @node Notes on Heavy-duty Customization, , Miscellaneous, Customization | |
1619 @section Notes on Heavy-duty Customization | |
1620 | |
1621 Some users need to customize Ediff in rather sophisticated ways, which | |
1622 requires different defaults for different kinds of files (e.g., SGML, | |
1623 etc.). Ediff supports this kind of customization in several ways. First, | |
1624 most customization variables are buffer-local. Those that aren't are | |
1625 usually accessible from within Ediff Control Panel, so one can make them | |
1626 local to the panel by calling make-local-variable from within | |
1627 @code{ediff-startup-hook}. | |
1628 | |
1629 Second, the function @code{ediff-setup} accepts an optional sixth | |
1630 argument which has the form @code{((@var{var-name-1} . @var{val-1}) | |
1631 (@var{var-name-2} . @var{val-2}) @dots{})}. The function | |
1632 @code{ediff-setup} sets the variables in the list to the respective | |
1633 values, locally in the Ediff control buffer. This is an easy way to | |
1634 throw in custom variables (which usually should be buffer-local) that | |
1635 can then be tested in various hooks. | |
1636 | |
1637 Make sure the variable @code{ediff-job-name} and @code{ediff-word-mode} are set | |
1638 properly in this case, as some things in Ediff depend on this. | |
1639 | |
1640 Finally, if you want custom-tailored help messages, you can set the | |
1641 variables @code{ediff-brief-help-message-function} and | |
1642 @code{ediff-long-help-message-function} | |
1643 to functions that return help strings. | |
1644 @vindex ediff-startup-hook | |
1645 @findex ediff-setup | |
1646 @vindex ediff-job-name | |
1647 @vindex ediff-word-mode | |
1648 @vindex ediff-brief-help-message-function | |
1649 @vindex ediff-long-help-message-function | |
1650 | |
1651 When customizing Ediff, some other variables are useful, although they are | |
1652 not user-definable. They are local to the Ediff control buffer, so this | |
1653 buffer must be current when you access these variables. The control buffer | |
1654 is accessible via the variable @code{ediff-control-buffer}, which is also | |
1655 local to that buffer. It is usually used for checking if the current buffer | |
1656 is also the control buffer. | |
1657 | |
1658 Other variables of interest are: | |
1659 @table @code | |
1660 @item ediff-buffer-A | |
1661 The first of the data buffers being compared. | |
1662 | |
1663 @item ediff-buffer-B | |
1664 The second of the data buffers being compared. | |
1665 | |
1666 @item ediff-buffer-C | |
1667 In three-way comparisons, this is the third buffer being compared. | |
1668 In merging, this is the merge buffer. | |
1669 In two-way comparison, this variable is nil. | |
1670 | |
1671 @item ediff-window-A | |
1672 The window displaying buffer A. If buffer A is not visible, this variable | |
1673 is nil or it may be a dead window. | |
1674 | |
1675 @item ediff-window-B | |
1676 The window displaying buffer B. | |
1677 | |
1678 @item ediff-window-C | |
1679 The window displaying buffer C, if any. | |
1680 | |
1681 @item ediff-control-frame | |
1682 A dedicated frame displaying the control buffer, if it exists. | |
1683 It is non-nil only if Ediff uses the multiframe display, i.e., when the | |
1684 control buffer is in its own frame. | |
1685 @end table | |
1686 | |
1687 @node Credits, Index, Customization, Top | |
1688 @chapter Credits | |
1689 | |
1690 Ediff was written by Michael Kifer <kifer@@cs.sunysb.edu>. It was inspired | |
1691 by emerge.el written by Dale R. Worley <drw@@math.mit.edu>. An idea due to | |
1692 Boris Goldowsky <boris@@cs.rochester.edu> made it possible to highlight | |
1693 fine differences in Ediff buffers. Alastair Burt <burt@@dfki.uni-kl.de> | |
1694 ported Ediff to XEmacs, and Eric Freudenthal <freudent@@jan.ultra.nyu.edu> | |
1695 made it work with VC. | |
1696 | |
1697 Many people provided help with bug reports, patches, and advice. | |
1698 Without them, Ediff would not be nearly as useful as it is today. | |
1699 Here is a full list of contributors (I hope I didn't miss anyone): | |
1700 | |
1701 @example | |
1702 Neal Becker (neal@@ctd.comsat.com), | |
1703 Alastair Burt (burt@@dfki.uni-kl.de), Paul Bibilo (peb@@delcam.co.uk), | |
1704 Kevin Broadey (KevinB@@bartley.demon.co.uk), | |
1705 Harald Boegeholz (hwb@@machnix.mathematik.uni-stuttgart.de), | |
1706 Bradley A. Bosch (brad@@lachman.com), | |
1707 Michael D. Carney (carney@@ltx-tr.com), | |
1708 Jin S. Choi (jin@@atype.com), | |
1709 Albert Dvornik (bert@@mit.edu), | |
1710 Eric Eide (eeide@@asylum.cs.utah.edu), | |
1711 Kevin Esler (esler@@ch.hp.com), Robert Estes (estes@@ece.ucdavis.edu), | |
1712 Xavier Fornari (xavier@@europe.cma.fr), | |
1713 Eric Freudenthal (freudent@@jan.ultra.nyu.edu), | |
1714 Job Ganzevoort (Job.Ganzevoort@@cwi.nl), | |
1715 Boris Goldowsky (boris@@cs.rochester.edu), | |
1716 Allan Gottlieb (gottlieb@@allan.ultra.nyu.edu), Xiaoli Huang (hxl@@epic.com), | |
1717 Larry Gouge (larry@@itginc.com), Karl Heuer (kwzh@@gnu.ai.mit.edu), | |
1718 (irvine@@lks.csi.com), (jaffe@@chipmunk.cita.utoronto.ca), | |
1719 David Karr (dkarr@@nmo.gtegsc.com), | |
1720 Norbert Kiesel (norbert@@i3.informatik.rwth-aachen.de), | |
1721 Leigh L Klotz (klotz@@adoc.xerox.com), Fritz Knabe (Fritz.Knabe@@ecrc.de), | |
1722 Heinz Knutzen (hk@@informatik.uni-kiel.d400.de), | |
1723 Andrew Koenig (ark@@research.att.com), | |
1724 Ken Laprade (laprade@@dw3f.ess.harris.com), Will C Lauer (wcl@@cadre.com), | |
1725 Richard Levitte (levitte@@e.kth.se), Mike Long (mike.long@@analog.com), | |
1726 Martin Maechler (maechler@@stat.math.ethz.ch), | |
1727 Simon Marshall (Simon.Marshall@@mail.esrin.esa.it), | |
1728 Richard Mlynarik (mly@@adoc.xerox.com), | |
1729 Chris Murphy (murphycm@@sun.aston.ac.uk), | |
1730 Erik Naggum (erik@@naggum.no), | |
1731 Eyvind Ness (Eyvind.Ness@@hrp.no), Ray Nickson (nickson@@cs.uq.oz.au), | |
1732 David Petchey (petchey_david@@jpmorgan.com), | |
1733 Benjamin Pierce (benjamin.pierce@@cl.cam.ac.uk), | |
1734 Tibor Polgar (tlp00@@spg.amdahl.com), | |
1735 David Prince (dave0d@@fegs.co.uk), | |
1736 Paul Raines (raines@@slac.stanford.edu), | |
1737 C.S. Roberson (roberson@@aur.alcatel.com), | |
1738 Kevin Rodgers (kevin.rodgers@@ihs.com), | |
1739 Sandy Rutherford (sandy@@ibm550.sissa.it), | |
1740 Heribert Schuetz (schuetz@@ecrc.de), Andy Scott (ascott@@pcocd2.intel.com), | |
1741 Axel Seibert (axel@@tumbolia.ppp.informatik.uni-muenchen.de), | |
1742 Richard Stallman (rms@@gnu.ai.mit.edu), | |
1743 Richard Stanton (stanton@@haas.berkeley.edu), | |
1744 Ake Stenhoff (etxaksf@@aom.ericsson.se), Stig (stig@@hackvan.com), | |
1745 Peter Stout (Peter_Stout@@cs.cmu.edu), Chuck Thompson (cthomp@@cs.uiuc.edu), | |
1746 Ray Tomlinson (tomlinso@@bbn.com), | |
1747 Raymond Toy (toy@@rtp.ericsson.se), | |
1748 Ben Wing (wing@@666.com), | |
1749 Ilya Zakharevich (ilya@@math.ohio-state.edu), | |
1750 Eli Zaretskii (eliz@@is.elta.co.il) | |
1751 @end example | |
1752 | |
1753 @node Index, , Credits, Top | |
1754 @unnumbered Index | |
1755 @printindex cp | |
1756 | |
1757 @contents | |
1758 @bye |