comparison lisp/ediff.el @ 12083:2bfc61a5fbe7

don't make the patch buffer RO. (ediff-load-version-control): now checks if ediff-revision-key is non-nil. (ediff-revision-key): Now defaults to nil. (ediff-revision): now takes prefix argument; can compare two versions of the same file. the merge buffer now assumes the major mode of the default variant. (ediff-documentation: new function. (ediff-patch-buffer): now handles buffers that don't visit any file. (ediff-windows): renamed to ediff-windows-wordwise, added (ediff-windows-linewise): new function. Changed ediff-small/large-regions to ediff-regions-wordwise/linewise Converted xemacs *screen* nomenclature to *frame*. Incorporated overlay strings. Ediff no longer runs under emacs 19.28 and earlier and XEmacs 19.11 and earlier. Changed window-system to ediff-window-display.
author Karl Heuer <kwzh@gnu.org>
date Mon, 05 Jun 1995 23:41:43 +0000
parents 898ec89f5379
children 5724b13e7b7b
comparison
equal deleted inserted replaced
12082:257af4819582 12083:2bfc61a5fbe7
3 3
4 ;; Author: Michael Kifer <kifer@cs.sunysb.edu> 4 ;; Author: Michael Kifer <kifer@cs.sunysb.edu>
5 ;; Created: February 2, 1994 5 ;; Created: February 2, 1994
6 ;; Keywords: comparing, merging, patching, version control. 6 ;; Keywords: comparing, merging, patching, version control.
7 7
8 (defconst ediff-version "2.19" "The current version of Ediff") 8 (defconst ediff-version "2.26" "The current version of Ediff")
9 (defconst ediff-date "March 14, 1995" "Date of last update") 9 (defconst ediff-date "June 3, 1995" "Date of last update")
10
11 ;; LCD Archive Entry:
12 ;; ediff|Michael Kifer|kifer@cs.sunysb.edu|
13 ;; A comprehensive visual interface to diff and patch|
14 ;; 14-March-95|2.19|~/packages/ediff.shar.Z|
15
16 10
17 ;; This file is part of GNU Emacs. 11 ;; This file is part of GNU Emacs.
18 12
19 ;; GNU Emacs is free software; you can redistribute it and/or modify 13 ;; GNU Emacs is free software; you can redistribute it and/or modify
20 ;; it under the terms of the GNU General Public License as published by 14 ;; it under the terms of the GNU General Public License as published by
36 ;; Never read that diff output again! 30 ;; Never read that diff output again!
37 ;; Apply patch selectively, like a pro! 31 ;; Apply patch selectively, like a pro!
38 ;; Merge with ease! 32 ;; Merge with ease!
39 33
40 ;; This package provides a convenient way of simultaneous browsing through 34 ;; This package provides a convenient way of simultaneous browsing through
41 ;; the differences between a pair (or a tripple) of files or buffers. The 35 ;; the differences between a pair (or a triple) of files or buffers. The
42 ;; files being compared, file-A, file-B, and file-C (if applicable) are 36 ;; files being compared, file-A, file-B, and file-C (if applicable) are
43 ;; shown in separate windows (side by side, one above the another, or in 37 ;; shown in separate windows (side by side, one above the another, or in
44 ;; separate frames), and the differences are highlighted as you step 38 ;; separate frames), and the differences are highlighted as you step
45 ;; through them. You can also copy difference regions from one buffer to 39 ;; through them. You can also copy difference regions from one buffer to
46 ;; another (and recover old differences if you change your mind). 40 ;; another (and recover old differences if you change your mind).
52 ;; Since Ediff lets you copy differences between buffers, you can, in 46 ;; Since Ediff lets you copy differences between buffers, you can, in
53 ;; effect, apply patches selectively (i.e., you can copy a difference 47 ;; effect, apply patches selectively (i.e., you can copy a difference
54 ;; region from file_orig to file, thereby undoing any particular patch that 48 ;; region from file_orig to file, thereby undoing any particular patch that
55 ;; you don't like). 49 ;; you don't like).
56 50
51 ;; Ediff is aware of version control, which lets the user compare
52 ;; files with their older versions. Ediff can also work with remote and
53 ;; compressed files. Details are given below.
54
57 ;; This package builds upon the ideas borrowed from emerge.el and 55 ;; This package builds upon the ideas borrowed from emerge.el and
58 ;; several Ediff's functions are adaptations from emerge.el. 56 ;; several Ediff's functions are adaptations from emerge.el.
59 ;; Much of the functionality of Ediff is also influenced by emerge.el. 57 ;; Much of the functionality of Ediff is also influenced by emerge.el.
60 58
61 ;; The present version of Ediff supersedes Emerge. It provides a superior 59 ;; The present version of Ediff supersedes Emerge. It provides a superior
62 ;; user interface and has many features not found in Emerge. In particular, 60 ;; user interface and has many features not found in Emerge. In particular,
63 ;; it can do patching and 2-way and 3-way file comparison in addition to 61 ;; it can do patching and 2-way and 3-way file comparison in addition to
64 ;; merging. 62 ;; merging.
65 63
66 ;; Ediff is aware of version control, which lets the user compare 64
67 ;; files with their older versions. Ediff can also work with remote and
68 ;; compressed files. Details are given below.
69
70
71 ;;; Remarks:
72 ;; -------
73
74 ;; 1. Ediff is heavily dependent on the new features of Emacs 19.
75 ;; It won't run under Emacs 18 at all.
76 ;; 2. If running XEmacs, Ediff requires at least version 19.9.
77 ;; 3. The function ediff-revision requires the version of vc.el that comes
78 ;; with Emacs 19.22 and XEmacs 19.10 and later, or rcs.el version 1.67
79 ;; or later. See "Version control support", below.
80
81
82 ;;; Installation and use:
83 ;; ---------------------
84
85 ;; The user can invoke Ediff interactively using the following functions:
86 ;;
87 ;; ediff-files - compare two files
88 ;; ediff - alias for ediff-files
89 ;; ediff-buffers - compare two buffers
90 ;;
91 ;; ediff-files3 - compare three files
92 ;; ediff3 - alias for ediff-files3
93 ;; ediff-buffers3 - compare three buffers
94 ;;
95 ;; ediff-windows - compare windows
96 ;; ediff-small-regions - compare small regions
97 ;; ediff-large-regions - compare large regions
98 ;;
99 ;; ediff-revision - compare buffer & version
100 ;;
101 ;; ediff-patch-file - patch file then compare
102 ;; epatch - alias for ediff-patch-file
103 ;; ediff-patch-buffer - patch buffer then compare
104 ;; epatch-buffer - alias for ediff-patch-buffer
105 ;;
106 ;; ediff-merge-files - merge two files
107 ;; ediff-merge - alias for ediff-merge-files
108 ;; ediff-merge-files-with-ancestor - same but with ancestor
109 ;; ediff-merge-with-ancestor - alias for the above
110 ;; ediff-merge-buffers - merge two buffers
111 ;; ediff-merge-buffers-with-ancestor - same but with ancestor
112 ;; ediff-merge-revisions - same but with ancestor
113 ;; ediff-merge-revisions-with-ancestor - same but with ancestor
114 ;;
115 ;;
116 ;;
117 ;; To use Ediff, put this in your .emacs file:
118 ;;
119 ;; (autoload 'ediff-buffers "ediff" "Visual interface to diff" t)
120 ;; (autoload 'ediff "ediff" "Visual interface to diff" t)
121 ;; (autoload 'ediff-files "ediff" "Visual interface to diff" t)
122 ;; (autoload 'ediff-buffers3 "ediff" "Visual interface to diff" t)
123 ;; (autoload 'ediff3 "ediff3" "Visual interface to diff" t)
124 ;; (autoload 'ediff-files3 "ediff" "Visual interface to diff" t)
125 ;; (autoload 'ediff-merge "ediff" "Visual interface to diff" t)
126 ;; (autoload 'ediff-merge-files "ediff" "Visual interface to diff" t)
127 ;; (autoload 'ediff-merge-files-with-ancestor "ediff"
128 ;; "Visual interface to diff" t)
129 ;; (autoload 'ediff-merge-with-ancestor "ediff" "Visual interface to diff" t)
130 ;; (autoload 'ediff-merge-buffers "ediff" "Visual interface to diff" t)
131 ;; (autoload 'ediff-merge-buffers-with-ancestor "ediff"
132 ;; "Visual interface to diff" t)
133 ;; (autoload 'ediff-merge-revisions "ediff" "Visual interface to diff" t)
134 ;; (autoload 'ediff-merge-revisions-with-ancestor "ediff"
135 ;; "Visual interface to diff" t)
136 ;; (autoload 'ediff-windows "ediff" "Visual interface to diff" t)
137 ;; (autoload 'ediff-small-regions "ediff" "Visual interface to diff" t)
138 ;; (autoload 'ediff-large-regions "ediff" "Visual interface to diff" t)
139 ;; (autoload 'epatch "ediff" "Visual interface to patch" t)
140 ;; (autoload 'ediff-patch-file "ediff" "Visual interface to patch" t)
141 ;; (autoload 'ediff-patch-buffer "ediff" "Visual interface to patch" t)
142 ;; (autoload 'epatch-buffer "ediff" "Visual interface to patch" t)
143 ;; (autoload 'ediff-revision "ediff"
144 ;; "Interface to diff & version control" t)
145 ;;
146 ;;
147 ;; If you want Ediff to be loaded from the very beginning, you should have
148 ;;
149 ;; (require 'ediff)
150 ;;
151 ;; in your .emacs file. This way it is also easier to figure out changes
152 ;; to the default Ediff setting, if such changes become necessary --- see
153 ;; Customization.
154 ;;
155 ;; All the above functions use the diff program to find different
156 ;; regions. They process diff output and display it to the user in a
157 ;; convenient form.
158 ;;
159 ;; The functions ediff-files, ediff-buffers, ediff-files3, ediff-buffers3
160 ;; first display the coarse, line-based difference regions, as commonly
161 ;; found by the diff program.
162 ;; Since diff may report fairly large chunks of text as being
163 ;; different even though the difference may be contained in a few words or
164 ;; even in the white space or line breaks, Ediff will further refine the
165 ;; regions to indicate which exact words differ. If the only difference is
166 ;; in the white space and line breaks, Ediff will say so.
167 ;;
168 ;; The functions ediff-windows, ediff-small-regions and ediff-large-regions
169 ;; do comparison on parts of buffers (which must already exist).
170 ;; Since ediff-windows and ediff-small-regions are intended for relatively
171 ;; small segments of the buffers, comparison is done on the
172 ;; word-basis rather than line basis. No refinement is necessary in this
173 ;; case. This technique is effective only for relatively small
174 ;; regions (perhaps, up to 100 lines), as these functions have a relatively
175 ;; slow startup.
176 ;; To compare large regions, use ediff-large-regions. In this mode, Ediff
177 ;; displays differences as it would if invoked via ediff-files or
178 ;; ediff-buffers.
179 ;;
180 ;; The functions ediff-patch-file and ediff-patch-buffer apply a patch
181 ;; to a file or a buffer and then run Ediff on these buffers, displaying
182 ;; the difference regions.
183 ;;
184 ;; Finally, for files under version control, ediff-revisions will compare a
185 ;; file to one of its versions.
186 65
187 ;;; Compilation 66 ;;; Compilation
188 ;; ----------- 67 ;; -----------
189 ;; 68 ;;
190 ;; When you byte-compile Ediff, you will get some warnings about functions 69 ;; When you byte-compile Ediff, you will get some warnings about functions
191 ;; being undefined. These can be safely ignored. 70 ;; being undefined. These can be safely ignored.
192 ;; 71 ;;
193
194 ;;; Customization:
195 ;; --------------
196
197 ;; Hooks:
198 ;; -----
199 ;; If you don't like the default setting, you can change it through the
200 ;; various variables and hooks. In particular, the following hooks are
201 ;; available:
202
203 ;; ediff-load-hooks
204 ;; ediff-keymap-setup-hooks
205 ;; ediff-before-setup-windows-hooks
206 ;; ediff-after-setup-windows-hooks
207 ;; ediff-before-setup-control-frame-hooks
208 ;; ediff-after-setup-control-frame-hooks
209 ;; ediff-startup-hooks
210 ;; ediff-select-hooks
211 ;; ediff-unselect-hooks
212 ;; ediff-suspend-hooks
213 ;; ediff-quit-hooks
214 ;; ediff-prepare-buffer-hooks
215 ;; ediff-display-help-hooks
216
217 ;; The hooks in ediff-load-hooks can be used to change defaults after Ediff
218 ;; is loaded. The hooks in ediff-keymap-setup-hooks can be used to alter
219 ;; bindings in Ediff's keymap. These hooks are called right after the
220 ;; default bindings are set.
221 ;;
222 ;; The hooks in ediff-before/after-setup-windows-hooks,
223 ;; ediff-suspend-hooks, and ediff-quit-hooks can be used to save and then
224 ;; restore whatever window configuration you want.
225
226 ;; Note that, by default, ediff-quit-hooks is set to a function,
227 ;; ediff-cleanup-mess, which cleans after Ediff, as appropriate in most
228 ;; cases. It is rather unlikely that the user will want to change
229 ;; it. However, the user may want add other hooks to ediff-quit-hooks,
230 ;; either before or after ediff-cleanup-mess (see the documentation for
231 ;; add-hook on how to do this). One should be aware that hooks executing
232 ;; before ediff-cleanup-mess start in ediff-control-buffer; they should
233 ;; also leave ediff-control-buffer as the current buffer. Hooks that are
234 ;; executed after ediff-cleanup-mess will have either buffer A or buffer B
235 ;; as the current buffer.
236
237 ;; If you are using packages such as mode-line.el to alter
238 ;; the buffer identification field in the mode line, you may have to
239 ;; restore this field after exiting Ediff by calling an appropriate
240 ;; function from a hook in ediff-quit-hooks (in case of mode-line.el, the
241 ;; function to call would be mode-line-abbreviate-buffer-identification).
242 ;; This should be done from a hook that runs before ediff-default-quit-hook,
243 ;; since such hooks run from within ediff-control-buffer, where buffers
244 ;; A, B, and C can be accessed via the variables ediff-buffer-A,
245 ;; ediff-buffer-B, ediff-buffer-C.
246
247 ;; The hooks ediff-before/after-setup-control-frame-hooks can be used to
248 ;; change how and where Ediff Control Panel is displayed, when it is
249 ;; displayed in a separate frame.
250
251 ;; However, be aware that many variables that drive Ediff are local to
252 ;; Ediff Control Panel, which requires special care in writing these hooks.
253 ;; Take a look at ediff-default-suspend-hook and ediff-default-quit-hook to
254 ;; see what's involved.
255
256 ;; The hooks in ediff-prepare-buffer-hooks are executed for each Ediff
257 ;; buffer (A, B, C) right after these buffers are arranged. Ediff runs the
258 ;; hooks in ediff-display-help-hooks each time after setting up the help
259 ;; message. Finally, ediff-mode-hooks are run just after ediff-mode is set
260 ;; up in the control buffer. This is done before any windows or frames are
261 ;; created. One can use it to set local variables that determine the
262 ;; look of the display.
263
264 ;; Quick help:
265 ;; ----------
266 ;;
267 ;; Ediff provides quick help using its control panel window. Since this
268 ;; window takes a fair share of the screen real estate, you can toggle it
269 ;; off by hitting `?'. The control window will then shrink to just one
270 ;; line and a mode line, displaying a short help message. The variable
271 ;;
272 ;; ediff-prefer-long-help-message
273 ;;
274 ;; Tells Ediff whether the user wants the short message initially or the
275 ;; long one. By default, it is set to nil, meaning that the short message
276 ;; will be shown on startup. Set this to t, if you want the long message
277 ;; initially.
278 ;; If you want to change the appearance of the help message on a
279 ;; per-buffer basis, you must use ediff-startup-hooks to change the value
280 ;; of ediff-help-message, which is a variable local to ediff-control-buffer.
281
282 ;; Window and frame configuration:
283 ;; -------------------------------
284
285 ;; In a non-windowing display, Ediff sets things up in one frame, splitting
286 ;; it between a small control window and the windows for file-A, file-B,
287 ;; and file-C. The split between these latter windows can be horizontal or
288 ;; vertical, which can be changed interactively by hitting `|' while the
289 ;; cursor is in the control window.
290 ;;
291 ;; On a window display, Ediff sets up a dedicated frame for Ediff Control
292 ;; Panel and then it would choose windows as follows: If one of the buffers
293 ;; is invisible, it will be displayed in the currently selected frame. If
294 ;; a buffer is visible, it will be displayed in the frame it is visible.
295 ;; If, according to the above criteria, the two buffers fall into the same
296 ;; frame, then be it---the frame will be shared by the two. The same
297 ;; algorithm works when you hit `C-l' (ediff-recenter), `p'
298 ;; (ediff-previous-difference), `n', etc.
299 ;;
300 ;; Thus, you can compare files in one frame or in different frames.
301 ;; The former is done by default, while the latter can be achieved by
302 ;; arranging files A, B (and C, if applicable) to be seen in different
303 ;; frames. Ediff respects these arrangements, automatically adapting
304 ;; itself to the multi-frame mode.
305
306 ;; Ediff uses the variables
307 ;;
308 ;; ediff-control-frame-parameters
309 ;; ediff-control-frame-position-function
310 ;;
311 ;; to set up its control panels. The user can change or augment
312 ;; ediff-control-frame-parameters including the font, color, etc. The X
313 ;; resource name of Ediff Control Panel frames is `Ediff'. Under X-windows,
314 ;; you can use this name to set up preferences in your ~/.Xdefaults
315 ;; (~/.xrdb, or whatever is in use). Usually this is preferable to changing
316 ;; ediff-control-frame-parameters directly. For instance, you can specify
317 ;; in ~/.Xdefaults where the control frame is to be sitting on the screen
318 ;; using the resource
319 ;;
320 ;; Ediff*geometry
321 ;;
322 ;; In general, any X resource pertaining the control frame can be reached
323 ;; via the prefix `Ediff*'.
324 ;;
325 ;; The prefered way of specifying the position of the control frame is by
326 ;; setting the variable ediff-control-frame-position-function to be a
327 ;; function to be called in order to determine the desired location for the
328 ;; control frame. The default value of this variable is
329 ;; `ediff-make-frame-position'. This function places the control frame in
330 ;; the vicinity of the North-East corner of the frame displaying buffer A.
331 ;; A pair of variables,
332 ;;
333 ;; ediff-narrow-control-frame-leftward-shift
334 ;; ediff-wide-control-frame-rightward-shift
335 ;; ediff-control-frame-upward-shift
336 ;;
337 ;; can be used to adjust the location produced by ediff-make-frame-position.
338 ;; The first variable specifies the number of characters for shifting
339 ;; the control frame from the rightmost edge of frame A when the control
340 ;; frame is displayed as a small window.
341 ;; The second variable specifies the rightward shift of the control frame
342 ;; from the left edge of frame A when the control frame shows the full
343 ;; menu of options.
344 ;; The third variable specifies the number of pixels for the upward shift
345 ;; of the control frame.
346 ;;
347 ;; If you truly and absolutely dislike the way Ediff sets up windows and if
348 ;; you can't customize this via frame parameters, the last resort is to
349 ;; rewrite the function `ediff-setup-windows'. However, we believe that
350 ;; detaching Ediff Control Panel from the rest and making it into a
351 ;; separate frame offers an important opportunity by allowing you to
352 ;; iconify that frame. Under Emacs, the icon will usually accept all of the
353 ;; Ediff commands, but will free up valuable real estate on your screen
354 ;; (this may depend on the window manager, though). Iconifying won't do any
355 ;; good under XEmacs since XEmacs icons do not seem to be sensitive to
356 ;; keyboard input. The saving grace is that, even if not iconified, the
357 ;; control frame is very small, smaller than some icons, so it doesn't take
358 ;; much space in any case.
359 ;;
360 ;; The variable
361 ;;
362 ;; ediff-prefer-iconified-control-frame
363 ;;
364 ;; if t, will cause the control frame to become iconified automatically when
365 ;; the help message is toggled off. This saves valuable real estate on the
366 ;; screen. Toggling help back will deiconify the control frame.
367 ;;
368 ;; To start ediff with an iconified Control Panel, you should set the above
369 ;; to t and ediff-prefer-long-help-message to nil.
370
371 ;; The variable
372 ;;
373 ;; ediff-window-setup-function
374 ;;
375 ;; Controls the way windows are setup. The above multiframe setup is
376 ;; achieved via ediff-setup-windows-multiframe function, which is a default
377 ;; on windowing displays (except for XEmacs 19.10 and earlier, which has a
378 ;; bug that breaks the multiframe display). The plain setup, one where all
379 ;; windows are always in one frame, is done via ediff-setup-windows-plain,
380 ;; which is the default on a non-windowing display (or in an xterm window).
381 ;; In fact, under Emacs, you can switch freely between these two setups by
382 ;; executing the command `ediff-toggle-multiframe'. However, don't try to
383 ;; do it under XEmacs, as it gets thoroughly confused if you switch from
384 ;; multiframe setup to plain setup within the same Ediff session.
385
386 ;; If you don't like either of these setups, write your own function. See
387 ;; the documentation for ediff-window-setup-function for the basic
388 ;; guidelines. However, writing window setups is not easy, so, before
389 ;; embarking on this job, you may want to take a close look at
390 ;; ediff-setup-windows-plain and ediff-setup-windows-multiframe.
391
392 ;; The user can run multiple Ediff sessions at once, by invoking it several
393 ;; times without exiting the previous Ediff sessions. Different sessions
394 ;; may even operate on the same pair of files. So, in principle, it is
395 ;; possible to do, say, pairwise comparison of three (or more) different
396 ;; files. Each session would have its own Ediff Control Panel and all the
397 ;; regarding a particular session is local to the associated control panel
398 ;; buffer. You can switch between sessions by suspending one session and
399 ;; then switching to another control panel. (Different control panel
400 ;; buffers are distinguished by a numerical suffix, e.g., Ediff Control
401 ;; Panel<3>.) Thus, if you would like to compare three files pairwise,
402 ;; you can do this by preparing three different frames, each with its data
403 ;; buffer to be compared. (No, I am not saying that such a 3way
404 ;; comparison is very easy to do.)
405 ;;
406 ;; If you need to conduct multiple Ediff sessions on the same file, one
407 ;; thing should be kept in mind: each time you invoke Ediff on a buffer that
408 ;; already participates in another Ediff session, that buffer should not
409 ;; have any ASCII Ediff flags in it. (Highlighting with faces is OK.) If
410 ;; flags are not removed, difference overlays won't be set correctly
411 ;; for the second invocation of Ediff. The simplest way to remove ASCII
412 ;; flags from an Ediff buffer is to hit `h' and thus switch to highlighting
413 ;; with faces (unhighlighting on a dumb terminal).
414
415 ;; Remote and Compressed Files
416 ;; ---------------------------
417
418 ;; Ediff will work with remote, compressed, and encrypted files. Ediff
419 ;; supports ange-ftp.el, jka-compr.el, uncompress.el and crypt++.el, but
420 ;; it may work with other similar packages as well. This
421 ;; means that you can compare files residing on another machine, or you
422 ;; can apply a patch to a file on another machine (even the patch itself
423 ;; can be a remote file!).
424 ;;
425 ;; When patching compressed or remote files, Ediff doesn't rename the
426 ;; source file into source-file-name_orig (unlike what `patch' would
427 ;; usually do). Instead, the source file retains its name and the result
428 ;; of applying the patch is placed in a temporary file that has the suffix
429 ;; `_patched'. Generally, this applies to files that are handled using
430 ;; black magic, such as special file handlers (ange-ftp and some
431 ;; compression and encryption packages all use this method).
432 ;;
433 ;; Regular files are treated by `patch' in the usual manner, i.e., the
434 ;; original is renamed into source-name_orig and the result of the patch
435 ;; is placed into the file source-name. (Ediff uses `_orig' instead of
436 ;; the usual `.orig' for compatibility with systems like VMS.)
437
438 ;;
439 ;; Selective browsing: Control over stepping through difference regions
440 ;; --------------------------------------------------------------------
441 ;;
442 ;; Sometimes it is convenient to be able to step through only some
443 ;; difference regions, those that satisfy certain conditions and to ignore
444 ;; all others. The commands `#f' and `#h' let the user specify regular
445 ;; expressions to control the way Ediff skips to the next or previous
446 ;; difference. Typing `#f' lets one specify of regular expressions,
447 ;; regexp-A, regexp-B, and regexp-C.
448 ;; Ediff will then start stepping only through those difference regions where
449 ;; the region in buffer A matches regexp-A and/or the region in buffer B
450 ;; matches regexp-B, etc. Whether `and' or `or' should be used depends on
451 ;; how the user responds to a prompt.
452 ;; Similarly, using `#h', one specifies expressions that match difference
453 ;; regions to be ignored while stepping through the differences. That is, if
454 ;; the buffer A part matches regexp-A, the buffer B part matches regexp B
455 ;; and (if applicable) buffer-C part matches regexp-C, then the region will
456 ;; be ignored by ediff-next-difference and ediff-previous-difference commands.
457 ;;
458 ;; Hitting `#f' and `#h' toggles this feature on/off.
459 ;;
460 ;; Note that selective browsing affects only ediff-next-difference and
461 ;; ediff-previous-difference, i.e., the commands invoked by typing n/SPC
462 ;; and p/DEL. You can still jump directly (using `j' or `ga/gb/gc') to any
463 ;; numbered difference. Also, it should be understood, that #f and #h do
464 ;; not change the position of the point in the buffers. The effect of these
465 ;; commands is seen only when the user types `n' or `p', i.e., when
466 ;; Ediff is told to jump to the next or previous difference.
467 ;;
468 ;; Users can supply their own functions that specify how Ediff should do
469 ;; selective browsing. To change the default Ediff function, add a function to
470 ;; ediff-load-hooks which will do the following assignments:
471 ;;
472 ;; (fset ediff-hide-regexp-matches 'your-hide-function)
473 ;; (fset ediff-focus-on-regexp-matches 'your-focus-function)
474 ;;
475 ;; Useful hints: To specify a regexp that matches everything, don't simply
476 ;; type RET in response to a prompt. Typing RET tells Ediff to accept the
477 ;; default value, which may not be what you want. Instead, one should enter
478 ;; something like `^' or `$' --- which would match every line.
479 ;;
480 ;; If the user doesn't remember if selective browsing is in effect and
481 ;; which regexps are being used, the status command, `i', will supply
482 ;; the requisite information.
483 ;;
484 ;; In addition to the ability to ignore regions that match regular
485 ;; expressions, Ediff can be ordered to start skipping over certain
486 ;; `inessential' regions. This is controlled by the variable
487 ;;
488 ;; ediff-ignore-similar-regions
489 ;;
490 ;; which, if set to t, will cause Ediff to skip over difference regions
491 ;; that has been found similar, i.e., where the only differences are those
492 ;; in the white space and newlines.
493 ;;
494 ;; Note: In order for this feature to work, auto-refining of difference
495 ;; regions must be on, since otherwise Ediff won't know if there are no
496 ;; fine differences between regions. Under X, auto-refining is a default,
497 ;; but it is nixed on a dumb terminal or in an Xterm window. Therefore, in
498 ;; a non-windowing environment, the user must explicitly turn
499 ;; auto-refining on (e.g., by typing `@').
500 ;;
501 ;; CAUTION: If many inessential regions appear in a row, Ediff may take a
502 ;; long time to jump to the next region because it has to compute fine
503 ;; differences of all intermediate regions.
504 ;;
505 ;;
506 ;; Highlighting difference regions
507 ;; -------------------------------
508 ;; The second group of Ediff variables that could be changed, if you so
509 ;; wish, is:
510 ;;
511 ;; ediff-before-flag-bol
512 ;; ediff-after-flag-eol
513 ;; ediff-before-flag-mol
514 ;; ediff-after-flag-mol
515 ;;
516 ;; ediff-current-diff-face-A
517 ;; ediff-current-diff-face-B
518 ;; ediff-current-diff-face-C
519 ;; ediff-fine-diff-face-A
520 ;; ediff-fine-diff-face-B
521 ;; ediff-fine-diff-face-C
522 ;; ediff-even-diff-face-A
523 ;; ediff-even-diff-face-B
524 ;; ediff-even-diff-face-C
525 ;; ediff-odd-diff-face-A
526 ;; ediff-odd-diff-face-B
527 ;; ediff-odd-diff-face-C
528 ;
529 ;; The first four are ASCII strings that mark the beginning and the end of
530 ;; the differences found in files A, B, and C. Ediff uses different flags
531 ;; to highlight regions that begin/end at the beginning of a line or in a
532 ;; middle of a line.
533
534 ;; The rest are the faces used to highlight text on X displays. On X
535 ;; displays, Ediff uses ediff-current-diff-face-A/B/C to highlight the
536 ;; current difference region.
537 ;;
538 ;; The faces ediff-fine-diff-face-A/B/C
539 ;; are used to show the fine differences between the current differences
540 ;; regions in buffers A, B, and C, respectively.
541 ;;
542 ;; Non-current difference regions are displayed in alternating
543 ;; faces: ediff-even/odd-diff-face-A/B/C. The odd and the even
544 ;; faces are actually identical on monochrome displays, because it is
545 ;; rather poor in what you can do on such a display. So, I chose to use
546 ;; italics to highlight other differences. Any ideas would be welcome.
547 ;; There are two ways to change the default setting for highlighting faces:
548 ;; either change the variables, as in
549 ;;
550 ;; (setq ediff-current-diff-face-A 'bold-italic)
551 ;;
552 ;; or
553 ;;
554 ;; (setq ediff-current-diff-face-A
555 ;; (copy-face 'bold-italic 'ediff-current-diff-face-A))
556 ;;
557 ;; or by selectively modifying the defaults:
558 ;;
559 ;; (add-hook 'ediff-load-hooks
560 ;; (function (lambda ()
561 ;; (set-face-foreground ediff-current-diff-face-B "blue")
562 ;; (set-face-background ediff-current-diff-face-B "red")
563 ;; (make-face-italic ediff-current-diff-face-B))))
564 ;;
565 ;; You may also want to take a look at how the above faces are defined in
566 ;; Ediff.
567 ;;
568 ;; Note: it is not recommended to use `internal-get-face' (or `get-face' in
569 ;; XEmacs) when defining faces for Ediff, since this may cause
570 ;; problems when there are several frames with different font sizes.
571 ;; Instead, use copy-face or set/make-face-* as shown above.
572 ;;
573 ;; The last variable in this group,
574 ;;
575 ;; ediff-highlight-all-diffs
576 ;;
577 ;; indicates whether---on a window system---the user wants differences to be
578 ;; marked using ASCII strings (like on a dumb terminal) or using colors and
579 ;; highlighting. Normally, Ediff highlights all differences, but the selected
580 ;; difference is highlighted more visibly. One can cycle through various
581 ;; modes of highlighting by hitting `h'. By default, Ediff starts in the
582 ;; mode where all difference regions are highlighted. If you prefer to
583 ;; start in the mode where unselected differences are not highlighted, you
584 ;; should set ediff-highlight-all-diffs to nil.
585 ;; You will still be able to turn on highlighting of all differences by
586 ;; hitting `h'.
587 ;;
588 ;; If you want to change the above variables, they must be set
589 ;; BEFORE Ediff is loaded.
590 ;;
591 ;; Note: Ediff lets you switch between the two types of highlighting. That
592 ;; is you can switch, interactively, from highlighting using faces to
593 ;; highlighting using ASCII flags, and back. Of course, toggling has
594 ;; effect only on a window system. On a dumb terminal or in an xterm
595 ;; window, the only available option is highlighting with ASCII flags.
596 ;;
597 ;; Selective display
598 ;; -----------------
599 ;; If buffers being compared are narrowed at the time of invocation of Ediff,
600 ;; ediff-buffers will preserve the narrowing range. However, if ediff-files
601 ;; is invoked on the files visited by these buffers, narrowing will be
602 ;; turned off, since we assume that the user wants to compare the entire files.
603 ;;
604 ;; Invocation of ediff-small/large-regions and ediff-windows will cause
605 ;; Ediff to set new narrowing ranges. However, the old ranges are preserved
606 ;; and will be returned to after quitting or by hitting `%'.
607 ;;
608 ;; Two variables control the behavior of ediff-windows,
609 ;; ediff-small-regions, and ediff-large-regions with respect to narrowing:
610 ;;
611 ;; ediff-start-narrowed
612 ;; ediff-quit-widened
613 ;;
614 ;; If ediff-start-narrowed is t, then Ediff will narrow display to the
615 ;; appropriate range if it is invoked as ediff-windows or
616 ;; ediff-small/large-regions.
617 ;; If it is nil, then narrowing will not take place. However, the user can
618 ;; still toggle narrowing on and off by typing `%'.
619 ;; Similarly, ediff-quit-widened controls whether Ediff should restore
620 ;; the visibility range that existed before the current invocation.
621 ;;
622 ;;
623 ;; Refinement of difference regions
624 ;; --------------------------------
625 ;; Ediff has variables that control the way fine differences are
626 ;; highlighted. This feature lets the user highlight the exact words that
627 ;; make the difference regions in comparison buffers different. This process
628 ;; ignores spaces, tabs, and newlines.
629 ;;
630 ;; ediff-auto-refine
631 ;; ediff-auto-refine-limit
632 ;;
633 ;; By default, `ediff-auto-refine' is `on', which means that fine differences
634 ;; within regions will be highlighted automatically. On a slow system, this
635 ;; feature may be undesirable. In any case, the user can always toggle
636 ;; auto-refining on/off/nix by hitting `@'. When auto-refining is off, fine
637 ;; differences will be shown only for regions for which these differences
638 ;; have been computed and saved before. If auto-refining is nixed, fine
639 ;; differences will not be shown at all. Hitting `*' will compute and
640 ;; display fine differences for the current difference region regardless of
641 ;; whether auto-refining is on, off, or nixed.
642 ;; If auto-refining is on, the variable `ediff-auto-refine-limit' limits
643 ;; the size of the regions to be auto-refined. This variable guards against
644 ;; possible slow-down that may be caused by an extraordinary large
645 ;; difference region.
646 ;;
647 ;; However, the user can always force region refining by typing `*'.
648 ;;
649 ;; Sometimes, when a difference region has too many differences between the
650 ;; variants, highlighting of fine differences stands in the way, especially
651 ;; on color displays. If that is the case, the user can invoke `*' with a
652 ;; negative prefix argument, which would unhighlight fine diffs for the
653 ;; current region.
654 ;;
655 ;; To unhighlight fine differences in all diff regions, use the command
656 ;; `@'. Repeated typing of this key cycles through three different states:
657 ;; auto-refining, no-auto-refining, and unhighlighting of all fine
658 ;; differences.
659 ;;
660 ;; The variable
661 ;;
662 ;; ediff-forward-word-function
663 ;;
664 ;; allows the user to control how fine differences are computed.
665 ;; The value must be a lisp function that determines how the
666 ;; current difference region should be split into words.
667 ;;
668 ;; Fine diferences are computed by first splitting the current difference
669 ;; region into words and then passing this along to
670 ;; `ediff-diff-program'. For the default ediff-forward-word-function,
671 ;; `ediff-forward-word', a word is a string consisting of letters, `-', or
672 ;; `_', a string of punctuation symbols, a string of digits, or a string
673 ;; consisting of symbols that are neither space, nor a letter.
674 ;;
675 ;; Patch and diff programs
676 ;; -----------------------
677 ;; The next group of variables determines the programs to be used for
678 ;; applying patches and for computing the main difference regions (not the
679 ;; fine difference regions):
680 ;;
681 ;; ediff-patch-program
682 ;; ediff-patch-options
683 ;; ediff-diff-program
684 ;; ediff-diff-options
685 ;; ediff-diff3-program
686 ;; ediff-diff3-options
687 ;;
688 ;; Warning about VMS: The output from VMS DIFF is not yet supported.
689 ;; Instead, make sure some implementation of Unix diff on VMS is used.
690 ;;
691 ;; These specify the functions that produce differences and do patching.
692 ;; The *-options variables specify which options to pass to these programs.
693 ;; It is unlikely that you would want to change these.
694 ;; However, sometimes you may want to tell diff to ignore spaces and
695 ;; such. Use the option '-w' for that.
696 ;; Diff has several other useful options (type 'man diff' to find out).
697 ;;
698 ;; However, Ediff doesn't let you use the option '-c', as it doesn't
699 ;; recognize this format yet. However, if you need to save the output from
700 ;; diff in a special form, Ediff lets you specify ``custom'' diff format
701 ;; using the following two variables:
702 ;;
703 ;; ediff-custom-diff-program
704 ;; ediff-custom-diff-options
705 ;;
706 ;; The output generated by ediff-custom-diff-program (which doesn't even
707 ;; have to be a Unix-style diff!) is not used by Ediff, except that you can
708 ;; save if using ediff-save-buffer function (normally bound to `wd' key
709 ;; sequence).
710 ;; However, Ediff is not the preferred way of producing diff output in
711 ;; Emacs, unless you also intend to use Ediff to browse through the diff'ed
712 ;; files. This is because diff.el (M-x diff), which also comes with Emacs,
713 ;; is much faster in yielding the output of diff, while Ediff consumes many
714 ;; resources.
715
716 ;; Support for diff3 and merging
717 ;; -----------------------------
718
719 ;; Ediff supports 3way comparison via the functions `ediff-files3' and
720 ;; `ediff-buffers3'. The interface is the same as for 2-way comparison.
721 ;; In 3-way comparison and merging, Ediff indicates if any two difference
722 ;; regions are identical. For instance, if the current region in buffer A
723 ;; is the same as the region in buffer C, then the mode line of buffer A will
724 ;; display [=diff(C)] and the mode line of buffer C will display [=diff(A)].
725 ;;
726 ;; Merging is done according to the following algorithm.
727 ;;
728 ;; If a diff region in one of the buffers, say B, differs from the ancestor
729 ;; while the region in the other buffer, A, doesn't, then the merge buffer,
730 ;; C, gets the B's region. Similarly when buffer A's region differs from
731 ;; the ancestor and B's doesn't.
732 ;;
733 ;; If both regions, A and B, differ from the ancestor, then Ediff chooses
734 ;; according to the value of
735 ;;
736 ;; ediff-default-variant
737 ;;
738 ;; If the value is `default-A' then A's region is chosen. If it is
739 ;; `default-B' then B's region is chosen. If the value of the above
740 ;; variable is `combined' then the region in buffer C will look like this:
741 ;;
742 ;; #ifdef NEW /* variant A */
743 ;; diff region from buffer A
744 ;; #else /* variant B */
745 ;; diff region from buffer B
746 ;; #endif /* NEW */
747 ;;
748 ;; The actual strings that separate the regions copied from bufer A and B
749 ;; are controled by the variable
750 ;;
751 ;; ediff-combination-pattern
752 ;;
753 ;; which must be a list of three strings.
754 ;;
755 ;; In addition to the state of the difference, during merging Ediff
756 ;; displays the state of the merge for each region. If a difference came
757 ;; from buffer A by default (because both regions A and B were different
758 ;; from the ancestor and ediff-default-variant was set to `default-A')
759 ;; then [=diff(A) default-A] is displayed in the mode line. If the
760 ;; difference in buffer C came, say, from buffer B because the diff region
761 ;; in that buffer differs from the ancestor, but the region in buffer A
762 ;; doesn't (if merging with an ancestor) then [=diff(B) prefer-B] is
763 ;; displayed. The indicators default-A/B and prefer-A/B are inspired by
764 ;; emerge.el and have the same meaning.
765 ;;
766 ;; Another indicator of the state of merge is `combined'. It appears
767 ;; with any difference region in buffer C that was obtained by combining
768 ;; the difference regions in buffers A and B as explained above.
769 ;;
770 ;; Note that the state-of-difference indicators `=diff(A)' and `=diff(B)'
771 ;; above are not redundant, even in the present of a state-of-merge
772 ;; indicator, as the two serve different purposes. For instance, if the
773 ;; mode line displays [=diff(B) prefer(B)] and you copy a diff region from
774 ;; buffer A to buffer C then `=diff(B)' will change to `diff-A' and the
775 ;; mode line will display [=diff(A) prefer-B].
776 ;; This indicates that the difference region in buffer C is identical to
777 ;; that in buffer A, but originally buffer C's region came from buffer B.
778 ;; This is useful to know because the original diff region in buffer C can
779 ;; be recovered by typing `r'.
780 ;;
781 ;; Ediff never changes the state-of-merge indicator, except as a result of
782 ;; the `!' command (see below), in which case the indicator is lost.
783 ;; On the other hand, the state-of-difference indicator is changed
784 ;; automatically by the copying/recovery commands, `a', `b', `r', `+'.
785 ;;
786 ;; If Ediff is asked to recompute differences via the command `!', the
787 ;; information about origins of the regions in the merge buffer (default-A,
788 ;; prefer-B, or combined) will be lost. This is because recomputing
789 ;; differences in this case means running diff3 on buffers A, B, and the
790 ;; merge buffer, not on the ancestor buffer. (It makes no sense to
791 ;; recompute differences with the ancestor, since Ediff assumes that the user
792 ;; doesn't edit buffers A and B, but he may have edited buffer C, and these
793 ;; changes are to be preserved.) Since some difference regions
794 ;; may disappear as a result of editing in buffer C and others may arise,
795 ;; there is generally no simple way to tell where the various regions
796 ;; in the merge buffer came from.
797 ;;
798 ;; In 3-way comparison, Ediff tries to disregard regions consisting of
799 ;; white space only as much as possible. For instance, if, say, the current
800 ;; region in buffer A consists of the white space only (or if it is empty),
801 ;; Ediff will not take it into account for the purpose of computing fine
802 ;; differences. The result is that Ediff can provide more visual
803 ;; information regarding the actual fine differences in the non-white
804 ;; regions B and C. Moreover, if the regions in buffers B and C differ in
805 ;; the white space only, then a message to this effect will be displayed.
806 ;;
807 ;; In merging, the variable
808 ;;
809 ;; ediff-merge-window-share
810 ;;
811 ;; controls the split between window C (the window for the merge-buffer)
812 ;; and the windows for buffers A and B. The default is 0.5. To make the
813 ;; merge-buffer window smaller, reduce this amount. It is not recommended
814 ;; to increase the size of the merge-window to more than half the frame
815 ;; (i.e., to increase the default value of ediff-merge-window-share),
816 ;; since it is then hard to see the contents of buffers A and B.
817 ;;
818 ;; The user can temporarily shrink the merge window to just one line by
819 ;; typing `s'. This change is temporary, until Ediff finds a reason to
820 ;; redraw the screen. Typing `s' again will restore the original window size.
821 ;;
822 ;; With a positive prefix argument, this command will make the merge window
823 ;; slightly taller. This change will hold throughout the current Ediff
824 ;; session. With `-' or a negative prefix argument, the command `s' makes
825 ;; the merge window slightly shorter. This change also holds through the
826 ;; entire current Ediff session.
827 ;;
828 ;; Ediff lets the user automatically skip regions where one of the buffer's
829 ;; regions is prefered because it disagrees with the ancestor, while the
830 ;; other buffer agrees with the ancestor. In this case, Ediff displays only
831 ;; the difference regions where the changes made to the original clash with
832 ;; each other. The variable that controls this behavior is
833 ;;
834 ;; ediff-show-clashes-only
835 ;;
836 ;; The value of this variable can be toggled interactively, by typing `$'.
837 ;; Note that this variable controls only how Ediff chooses the
838 ;; next/previous difference to show. The user can still jump directly to
839 ;; any difference using the command `j' (with prefix argument specifying
840 ;; the difference number).
841
842 ;; Version control support
843 ;; -----------------------
844 ;; Ediff supports version control via vc.el (in the standard
845 ;; distribution of Emacs 19) and rcs.el. The latter is a package written by
846 ;; Sebastian Kremer <sk@thp.Uni-Koeln.DE>, which is available in
847 ;;
848 ;; ftp.cs.buffalo.edu:pub/Emacs/rcs.tar.Z
849 ;; ftp.uni-koeln.de:/pub/gnu/emacs/rcs.tar.Z
850 ;;
851 ;; To specify which version control package you are using, set the variable
852 ;; ediff-version-control-package, e.g.,
853 ;; (setq ediff-version-control-package 'rcs)
854 ;; The default, is `vc'.
855 ;; Note: both packages provide access to RCS, but only vc.el comes standard
856 ;; with Emacs and XEmacs.
857 ;; For files under revision control, one key (usually `=') is bound to the
858 ;; function ediff-revision, which runs Ediff on the current buffer and one
859 ;; of its versions. Use the variable
860 ;;
861 ;; ediff-revision-key
862 ;;
863 ;; if you want to change this binding, e.g., (setq ediff-revision-key "\C-cD")
864
865 ;;
866 ;; Mode line
867 ;; ---------
868 ;;
869 ;; When Ediff is running, the mode line of Ediff Control Panel buffer
870 ;; displays the current difference being displayed and the total number of
871 ;; difference regions in the two files.
872 ;;
873 ;; The mode line of the buffers being compared displays the type of the
874 ;; buffer (`A:' or `B:') and (usually) the file name. Ediff is trying to be
875 ;; intelligent in choosing mode line buffer identification. In particular,
876 ;; it works well with uniquify.el and mode-line.el packages (which improve
877 ;; on the default way in which Emacs displays buffer identification).
878 ;; If you don't like the way Ediff identifies its buffers, there is always
879 ;; ediff-prepare-buffer-hooks, which can be used to modify the mode line.
880 ;;
881 ;; Miscellaneous
882 ;; -------------
883 ;; The last batch of variables that can be modified is
884 ;;
885 ;; ediff-split-window-function
886 ;; ediff-merge-split-window-function
887 ;; ediff-make-wide-display-function
888 ;; ediff-use-last-dir
889 ;; ediff-no-emacs-help-in-control-buffer
890 ;; ediff-toggle-read-only-function
891
892 ;; ediff-split-window-function controls the way you want the window be
893 ;; split between file-A and file-B (and file-C, if applicable). It
894 ;; defaults to vertical split, but you can set it to
895 ;; split-window-horizontally, if you want.
896 ;; The variable ediff-merge-split-window-function controls how windows are
897 ;; split between buffers A and B in merging jobs.
898
899 ;; Ediff lets you toggle the way
900 ;; windows are split, so you can try different settings interactively.
901 ;; Note: if file-A and file-B (and file-C, if applicable) are in different
902 ;; frames, windows are not split, regardless of the value
903 ;; ediff-split-window-function. Instead, other windows on these frames are
904 ;; deleted and Ediff starts displaying file-A/B/C using these
905 ;; frames, one file per frame. You can then switch to one-frame mode
906 ;; simply by hiding one of the buffers A/B/C.
907 ;;
908 ;; Note that if Ediff detects that the two buffers it compares are residing in
909 ;; separate frames, it assumes that the user wants them to be so displayed
910 ;; and stops splitting windows. Instead, it will arrange each buffer to
911 ;; occupy its own frame (possibly shared with Ediff's help window).
912 ;;
913 ;; The user can swap the windows in which buffers are displayed by typing `~'.
914 ;; Furthermore, the user can toggle wide/regular display by typing
915 ;; `m'. This is particularly useful when files are compared side-by-side.
916 ;; By default, the display is widened without changing its height. However,
917 ;; the user can set the variable
918 ;;
919 ;; ediff-make-wide-display-function
920 ;;
921 ;; to contain the name of a function to be called to widen the frame in
922 ;; which to display the buffers. See the documentation string for
923 ;; `ediff-make-wide-display-function' for details. It is also recommended
924 ;; to look into how the default function, `ediff-make-wide-display' is
925 ;; written.
926 ;;
927 ;;
928 ;; The variable ediff-use-last-dir controls the way Ediff presents the
929 ;; default directory when it prompts the user for files to compare. If nil,
930 ;; Ediff will use the default directory of the current buffer when it
931 ;; prompts the user for file names. Otherwise, it will use the
932 ;; directories it had previously used for file-A/B/C.
933 ;;
934 ;; The variable ediff-no-emacs-help-in-control-buffer, if set to t, makes C-h
935 ;; behave like the DEL key, i.e., it will move you back to the previous
936 ;; difference rather than invoking help. This is useful when, in an xterm
937 ;; window or on a dumb terminal, the Backspace key is bound to C-h and is
938 ;; positioned more conveniently than the DEL key.
939 ;;
940 ;; The variable ediff-toggle-read-only-function can be used to change the
941 ;; way Ediff toggles the read-only property in its buffers.
942 ;; By default, Ediff uses toggle-read-only. For files under version
943 ;; control, Ediff first tries to check the files out.
944
945
946 ;;; Commands
947 ;; --------
948
949 ;; All Ediff commands are displayed in a help window, unless you hit '?' to
950 ;; shrink it to just one line. You can redisplay the help window by hitting
951 ;; '?' again.
952 ;;
953 ;; Many Ediff commands take numeric prefix arguments. For instance, if you
954 ;; hit a number, N, and then `j' (ediff-jump-to-difference), Ediff will
955 ;; take you to Nth difference. Hitting a number, N, and then `ab'
956 ;; (ediff-diff-to-diff) will copy Nth difference from buffer A to buffer B.
957 ;; Hitting `ba' does copying in the other direction. Likewise, `ca' would
958 ;; copy from buffer C to buffer A (if buffer C exists, of course).
959 ;; Likewise, a number, N, followed by `ra' will restore the Nth difference
960 ;; region in buffer A (if it was previously saved as a result of copying
961 ;; from buffer B to A).
962 ;;
963 ;; Without the prefix argument, all commands operate on the current
964 ;; difference region.
965 ;;
966 ;; The total number of differences and the current difference number are
967 ;; always displayed in the mode line of the control window.
968 ;;
969 ;; If, after making changes to buffers A, B, or C, you decide to save them,
970 ;; it is recommended to use `ediff-save-buffer', which is bound to `wa', `wb',
971 ;; and `wc' (`wa will save buffer A, `wb' saves buffer B, etc.).
972 ;;
973 ;; Typing `wd' saves the diff output in a file.
974
975 ;; The command `s' is used only for merging. It allows the user to shrink
976 ;; window C to its minimal size, thereby exposing as much of buffers A and
977 ;; B as possible.
978 ;; This command is intended only for temporary viewing. Therefore, Ediff
979 ;; will restore the original window size for buffer C whenever window
980 ;; configuration is changed by the user (on toggling help, split,
981 ;; etc.). However, recentering and jumping to a difference doesn't affect
982 ;; window C. Typing `s' again restores the original size of the merge
983 ;; window.
984 ;;
985 ;; With a positive prefix argument, the command `s' makes the merge
986 ;; window, window C, slightly taller. With `-' or a negative prefix
987 ;; argument, `s' makes window C slightly shorter.
988 ;;
989 ;; While browsing through differences in the merge mode, one may discover
990 ;; that the default variant was chosen inappropriately, which means that
991 ;; the user will have to do a lot of copying manually. To facilitate this,
992 ;; there is a command, bound to `&', which will cause Ediff to start
993 ;; merging anew beginning with the current difference and using the
994 ;; alternative default variant (the user is asked to type in the new
995 ;; default for merging, which can be either `default-A', `default-B', or
996 ;; `combined'.
997 ;;
998 ;; Such repeated merging affects only difference regions that have
999 ;; default-A/B status, and only if they were not changed with respect to
1000 ;; their originals.
1001 ;;
1002 ;; Another command that is used for merging only is `+'. Its effect is to
1003 ;; combine the current difference regions of buffers A and B and put the
1004 ;; combination into the merge buffer. See `ediff-combine-diffs' and
1005 ;; `ediff-combination-pattern' for details.
1006 ;;
1007 ;; There is also one command the is not bound to any key:
1008 ;;
1009 ;; ediff-revert-buffers-then-recompute-diffs
1010 ;;
1011 ;; It is useful when, after making changes, you decided to make a fresh
1012 ;; start, or if at some point you changed the files being compared but want
1013 ;; to discard any changes to comparison buffers that were done since then.
1014 ;; This command will ask for confirmation before reverting files. With a
1015 ;; prefix argument, it will revert files without asking.
1016
1017 ;;; Heavy-duty customization:
1018 ;; -------------------------
1019
1020 ;; Some users need to customize Ediff in rather sophisticated ways, which
1021 ;; requires different defaults for different kinds of files (e.g., SGML, etc.).
1022 ;; Ediff supports this kind of customization is several ways.
1023 ;; First, most customization variables are buffer-local. Those that aren't
1024 ;; are usually accessible from within Ediff Control Panel, so one can make
1025 ;; thel local to the panel by calling make-local-variable from within
1026 ;; ediff-startup-hooks.
1027 ;; Second, there is now a new optional (6-th) argument to ediff-setup,
1028 ;; which has the form ( (var-name-1 . val-1) (var-name-2 . val-2) ...).
1029 ;; The function ediff-setup will set the variables on the list to the
1030 ;; respective values in the ediff control buffer. This is an easy way to
1031 ;; throw in custom variables (which usually should be buffer-local) that
1032 ;; can then be tested in various hooks.
1033 ;; Make sure the variable ediff-job-name and ediff-word-mode are set
1034 ;; properly in this case, as some things in Ediff depend on this.
1035 ;; Finally, if custom-tailored help messages are desired, Ediff has
1036 ;; ediff-brief-help-message-custom and ediff-long-help-message-custom,
1037 ;; which are local variables that can be either set to
1038 ;; a function that returns a string.
1039
1040
1041 ;;; Bugs: 72 ;;; Bugs:
1042 ;; ----- 73 ;; -----
1043 74
1044 ;; 1. The undo command doesn't restore deleted regions well. That is, if 75 ;; 1. The undo command doesn't restore deleted regions well. That is, if
1045 ;; you delete all characters in a difference region and then invoke 76 ;; you delete all characters in a difference region and then invoke
1048 ;; doesn't seem to exist with XEmacs.) 79 ;; doesn't seem to exist with XEmacs.)
1049 ;; 80 ;;
1050 ;; If at any point you feel that difference regions are no longer correct, 81 ;; If at any point you feel that difference regions are no longer correct,
1051 ;; you can hit '!' to recompute the differences. 82 ;; you can hit '!' to recompute the differences.
1052 83
1053 ;; 2. Emacs 19.xx, where xx < 23, has several bugs related to overlays and 84 ;; 2. On a monochrome display, the repertoire of faces with which to
1054 ;; faces. Somethimes, these may cause highlighting of the refinements or
1055 ;; of the unselected differences to disappear. Hitting `!' will bring them
1056 ;; back. In version 19.23 and later, these problems no longer occur.
1057
1058 ;; 3. On a monochrome display, the repertoire of faces with which to
1059 ;; highlight fine differences is limited. By default, Ediff is using 85 ;; highlight fine differences is limited. By default, Ediff is using
1060 ;; underlining. However, if the region is already underlied by some other 86 ;; underlining. However, if the region is already underlied by some other
1061 ;; overlays, there is no simple way to temporarily remove that residual 87 ;; overlays, there is no simple way to temporarily remove that residual
1062 ;; underlining. This problem occurs when a buffer is highlighted with 88 ;; underlining. This problem occurs when a buffer is highlighted with
1063 ;; hilit19.el or font-lock.el packages. If this residual highlighting gets 89 ;; hilit19.el or font-lock.el packages. If this residual highlighting gets
1064 ;; in the way, you can do the following. Both font-lock.el and hilit19.el 90 ;; in the way, you can do the following. Both font-lock.el and hilit19.el
1065 ;; provide commands for unhighlighting buffers. You can either place these 91 ;; provide commands for unhighlighting buffers. You can either place these
1066 ;; commands in `ediff-prepare-buffer-hooks' (which will unhighlight every 92 ;; commands in `ediff-prepare-buffer-hooks' (which will unhighlight every
1067 ;; buffer used by Ediff) or you can execute them interactively, at any time 93 ;; buffer used by Ediff) or you can execute them interactively, at any time
1068 ;; and on any buffer. 94 ;; and on any buffer.
1069 95 ;;
1070 ;; 4. In XEmacs (statically linked with Motif libraries), emerge.el
1071 ;; and hence Ediff won't start, unless you set (setq scrollbar-width 0).
1072 ;; This is a Motif-related bug, I was told.
1073
1074 ;; 5. XEmacs 19.11 (and, probably, earlier versions) has trouble
1075 ;; positioning the point withing Ediff buffers on Ediff's startup.
1076 ;; This doesn't get in the way, though, since when the user start looking
1077 ;; at the diff regions, they are positioned correctly. It seems that
1078 ;; XEmacs doesn't have enough time to redisplay windows---it does this
1079 ;; correctly when it is told to redisplay (sit-for 0).
1080
1081 ;; 6. It seems that XEmacs icons are insensitive to keyboard events. This
1082 ;; deprives XEmacs users from being able to iconify Ediff's control panel,
1083 ;; thereby saving space onthe screen. Also, it seems that XEmacs doesn't
1084 ;; let one create minibuffer-less frames, which leaves Ediff control Panel
1085 ;; with a useless minibuffer. The "unsplittable" property is also ignored
1086 ;; in XEmacs, some further minor annoyances are possible.
1087
1088 ;; 7. XEmacs (19.11 and below) doesn't let one create minibufferless
1089 ;; frames. This causes the problem that messages are displayed in a small
1090 ;; control frame window, when help is toggled off. Ediff overcomes this by
1091 ;; setting synchronize-minibuffers to t, which causes all messages to be
1092 ;; displayed in all minibuffers. If you detest this, set
1093 ;; synchronize-minibuffers to nil after quitting Ediff.
1094
1095 96
1096 ;;; Change Log: 97 ;;; Change Log:
1097 ;; ---------- 98 ;; ----------
1098 99
1099 ;; Thu Feb 3, 1994 100 ;; Thu Feb 3, 1994
1326 ;; ediff-diff-to-diff in Lemacs. 327 ;; ediff-diff-to-diff in Lemacs.
1327 328
1328 ;; Tue May 31, 1994 329 ;; Tue May 31, 1994
1329 330
1330 ;; Added ediff-forward-word-function (as suggested by Job Ganzevoort 331 ;; Added ediff-forward-word-function (as suggested by Job Ganzevoort
1331 ;; <Job.Ganzevoort@cwi.nl>). Modified ediff-default-quit-hook so it 332 ;; <Job.Ganzevoort@cwi.nl>).
1332 ;; will clean things up in a more satisfactory way.
1333 333
1334 ;; Thu Jun 2, 1994 334 ;; Thu Jun 2, 1994
1335 335
1336 ;; Added `ediff-toggle-regexp-match', which allows the user to step 336 ;; Added `ediff-toggle-regexp-match', which allows the user to step
1337 ;; through only those difference regions that match some regexp; or, 337 ;; through only those difference regions that match some regexp; or,
1399 ;; Added ediff-submit-report. 399 ;; Added ediff-submit-report.
1400 ;; Introduced ediff-revision as a uniform way of calling vc.el and 400 ;; Introduced ediff-revision as a uniform way of calling vc.el and
1401 ;; rcs.el. This is controled by ediff-version-control-package 401 ;; rcs.el. This is controled by ediff-version-control-package
1402 ;; variable. Functions vc-ediff, rcs-ediff are replaced by their 402 ;; variable. Functions vc-ediff, rcs-ediff are replaced by their
1403 ;; internal versions. 403 ;; internal versions.
1404 ;; Added ediff-find-file-name-handler function to smooth out the
1405 ;; transition from Emacs 19.22/XEmacs 19.9 to 19.23/19/10
1406 404
1407 ;; Thu September 1, 1994 405 ;; Thu September 1, 1994
1408 406
1409 ;; Made ediff-overlay-put and ediff-move-overlay into bona fide 407 ;; Made ediff-overlay-put and ediff-move-overlay into bona fide
1410 ;; functions (rather than fset symbols). These now check if overlay's 408 ;; functions (rather than fset symbols). These now check if overlay's
1449 ;; generating context diffs. Added ediff-make-frame-position and 447 ;; generating context diffs. Added ediff-make-frame-position and
1450 ;; ediff-control-frame-position-function. 448 ;; ediff-control-frame-position-function.
1451 449
1452 ;; Wed October 12, 1994 450 ;; Wed October 12, 1994
1453 451
1454 ;; ediff-window-visible-p now makes a call to ediff-frame-visible-p 452 ;; ediff-window-visible-p now makes a call to frame-visible-p
1455 ;; only when window-system is non-nil. Rearranged the block of fset's 453 ;; only when window-system is non-nil. Rearranged the block of fset's
1456 ;; so that the wrong things won't be defined when window-system is nil. 454 ;; so that the wrong things won't be defined when window-system is nil.
1457 ;; Added ediff-revert-buffers-then-recompute-diffs function. 455 ;; Added ediff-revert-buffers-then-recompute-diffs function.
1458 ;; Removed flag-argument from a background call to shell-command. 456 ;; Removed flag-argument from a background call to shell-command.
1459 ;; Added ediff-shell-command to enable custom diff execute in the 457 ;; Added ediff-shell-command to enable custom diff execute in the
1510 ;; Added ediff-toggle-wide-display. In plain display, help message is 508 ;; Added ediff-toggle-wide-display. In plain display, help message is
1511 ;; now centered correctly. 509 ;; now centered correctly.
1512 510
1513 ;; Fri December 9, 1994 511 ;; Fri December 9, 1994
1514 512
1515 ;; Added ediff-toggle-multiframe (it doesn't work with XEmacs for some 513 ;; Added ediff-toggle-multiframe.
1516 ;; reason). Fixed ediff-pop-diff and ediff-copy-diff, so that they will 514 ;; Fixed ediff-pop-diff and ediff-copy-diff, so that they will
1517 ;; invoke auto-refining, if necessary. 515 ;; invoke auto-refining, if necessary.
1518 516
1519 ;; Mon December 12, 1994 517 ;; Mon December 12, 1994
1520 518
1521 ;; Modified ediff-toggle-wide-display so it would funcall 519 ;; Modified ediff-toggle-wide-display so it would funcall
1623 ;; are set up. Previously, it didn't work right with selective display. 621 ;; are set up. Previously, it didn't work right with selective display.
1624 ;; Also, added ediff-profile to time Ediff commands and 622 ;; Also, added ediff-profile to time Ediff commands and
1625 ;; ediff-debug-info for civilized display of the difference vectors 623 ;; ediff-debug-info for civilized display of the difference vectors
1626 ;; (and possibly more in the future). 624 ;; (and possibly more in the future).
1627 625
1628 ;; Tue March 14 626 ;; Tue March 18
1629 627
1630 ;; Fixed ediff-diff-at-point. 628 ;; Fixed ediff-diff-at-point and ediff-toggle-multiframe.
629 ;; Added ediff-destroy-control-frame, ediff-window-display-p. The latter
630 ;; replaces window-system in many cases. Needed because in XEmacs 19.12
631 ;; window-system returns 'tty on a tty display.
632 ;; Converted xemacs *screen* nomenclature to *frame*.
633 ;; Made ediff-patch-buffer cope with buffers that don't visit any file.
634 ;; Fixed ediff-toggle-read-only so it knows the difference between
635 ;; version-controlled files and others. It also knows whether we are using
636 ;; patch or not.
637 ;; Renamed ediff-windows to ediff-windows-wordwise, added
638 ;; ediff-windows-linewise. Changed ediff-small/large-regions to
639 ;; ediff-regions-wordwise/linewise
640
641 ;; Tue May 2
642
643 ;; Added ediff-documentation. Fixes for XEmacs 19.12.
644 ;; Merge buffer now assumes the major mode of ediff-default-variant.
645
646 ;; Mon May 31, 1995
647
648 ;; Ediff-revision now takes a prefix argument. Can compare two versions of
649 ;; the same file. Cleaned up ediff-make-control-frame.
650 ;; Fixed a bug in ediff-get-visible-buffer-window.
651 ;; Added ediff-cleanup-hooks, ediff-janitor.
652 ;; ediff-cleanup-hooks is called before ediff-quit-hooks.
1631 653
1632 654
1633 ;;; TO DO: 655 ;;; TO DO:
1634 ;; ------ 656 ;; ------
1635 ;; 657 ;;
1653 ;; Estes <estes@ece.ucdavis.edu>, Eric Freudenthal 675 ;; Estes <estes@ece.ucdavis.edu>, Eric Freudenthal
1654 ;; <freudent@jan.ultra.nyu.edu>, 676 ;; <freudent@jan.ultra.nyu.edu>,
1655 ;; Job Ganzevoort <Job.Ganzevoort@cwi.nl>, Boris Goldowsky 677 ;; Job Ganzevoort <Job.Ganzevoort@cwi.nl>, Boris Goldowsky
1656 ;; <boris@cs.rochester.edu>, Allan Gottlieb <gottlieb@allan.ultra.nyu.edu>, 678 ;; <boris@cs.rochester.edu>, Allan Gottlieb <gottlieb@allan.ultra.nyu.edu>,
1657 ;; Xiaoli Huang <hxl@epic.com>, Larry Gouge <larry@itginc.com>, 679 ;; Xiaoli Huang <hxl@epic.com>, Larry Gouge <larry@itginc.com>,
1658 ;; irvine@lks.csi.com, jaffe@chipmunk.cita.utoronto.ca, David Karr 680 ;; Karl Heuer <kwzh@gnu.ai.mit.edu>, <irvine@lks.csi.com>,
681 ;; <jaffe@chipmunk.cita.utoronto.ca>, David Karr
1659 ;; <dkarr@nmo.gtegsc.com>, Norbert Kiesel 682 ;; <dkarr@nmo.gtegsc.com>, Norbert Kiesel
1660 ;; <norbert@i3.informatik.rwth-aachen.de>, Fritz Knabe <Fritz.Knabe@ecrc.de>, 683 ;; <norbert@i3.informatik.rwth-aachen.de>, Fritz Knabe <Fritz.Knabe@ecrc.de>,
1661 ;; Heinz Knutzen <hk@informatik.uni-kiel.d400.de>, Ken Laprade 684 ;; Heinz Knutzen <hk@informatik.uni-kiel.d400.de>, Ken Laprade
1662 ;; <laprade@dw3f.ess.harris.com>, Richard Levitte 685 ;; <laprade@dw3f.ess.harris.com>, Richard Levitte
1663 ;; <levitte@e.kth.se>, Martin Maechler <maechler@stat.math.ethz.ch>, 686 ;; <levitte@e.kth.se>, Martin Maechler <maechler@stat.math.ethz.ch>,
1709 "Last directory used by an Ediff command for file to patch.") 732 "Last directory used by an Ediff command for file to patch.")
1710 733
1711 ;;; Patching 734 ;;; Patching
1712 735
1713 ;;;###autoload 736 ;;;###autoload
1714 (defun ediff-patch-file (source-filename &optional startup-hooks) 737 (defun ediff-patch-file (source-filename &optional startup-hooks job-name)
1715 "Run Ediff by patching FILE-TP-PATCH." 738 "Run Ediff by patching FILE-TP-PATCH."
739 ;; This now returns the control buffer
1716 (interactive 740 (interactive
1717 (list (ediff-read-file-name "File to patch" 741 (list (ediff-read-file-name "File to patch"
1718 (if ediff-use-last-dir 742 (if ediff-use-last-dir
1719 ediff-last-dir-patch 743 ediff-last-dir-patch
1720 default-directory) 744 default-directory)
1721 nil))) 745 nil)))
1722 746
1723 (setq source-filename (expand-file-name source-filename)) 747 (setq source-filename (expand-file-name source-filename))
1724 (ediff-get-patch-buffer (file-name-directory source-filename)) 748 (ediff-get-patch-buffer
749 (if (eq job-name 'ediff-patch-buffer)
750 (ediff-eval-in-buffer (get-file-buffer source-filename)
751 default-directory)
752 (file-name-directory source-filename)))
1725 753
1726 (let* ((backup-extension 754 (let* ((backup-extension
1727 ;; if the user specified a -b option, extract the backup 755 ;; if the user specified a -b option, extract the backup
1728 ;; extension from there; else use `_orig' 756 ;; extension from there; else use `_orig'
1729 (substring ediff-patch-options 757 (substring ediff-patch-options
1736 ;; so, we save source-filename and true-source-filename as a var 764 ;; so, we save source-filename and true-source-filename as a var
1737 ;; that initially is source-filename but may be changed to a temp 765 ;; that initially is source-filename but may be changed to a temp
1738 ;; file for the purpose of patching. 766 ;; file for the purpose of patching.
1739 (true-source-filename source-filename) 767 (true-source-filename source-filename)
1740 (target-filename source-filename) 768 (target-filename source-filename)
1741 target-buf buf-to-patch file-name-magic-p) 769 target-buf buf-to-patch file-name-magic-p ctl-buf)
1742 770
1743 ;; if the user didn't specify a backup extension, use _orig 771 ;; if the user didn't specify a backup extension, use _orig
1744 (if (string= backup-extension "") 772 (if (string= backup-extension "")
1745 (setq backup-extension "_orig")) 773 (setq backup-extension "_orig"))
1746 774
1756 ;; true-source-filename should be either the original name or a 784 ;; true-source-filename should be either the original name or a
1757 ;; temporary file where we put the after-product of the file handler. 785 ;; temporary file where we put the after-product of the file handler.
1758 (setq file-name-magic-p (not (equal (file-truename true-source-filename) 786 (setq file-name-magic-p (not (equal (file-truename true-source-filename)
1759 (file-truename source-filename)))) 787 (file-truename source-filename))))
1760 788
1761 ;; Checkout orig file, if necessary so that the patched file could be 789 ;; Checkout orig file, if necessary, so that the patched file could be
1762 ;; checked back in. 790 ;; checked back in.
1763 (ediff-toggle-read-only buf-to-patch) 791 (if (ediff-file-checked-in-p (buffer-file-name buf-to-patch))
792 (ediff-toggle-read-only buf-to-patch))
1764 793
1765 (ediff-eval-in-buffer ediff-patch-diagnostics 794 (ediff-eval-in-buffer ediff-patch-diagnostics
1766 (message "Applying patch ... ")(sit-for 0) 795 (message "Applying patch ... ")(sit-for 0)
1767 ;; always pass patch the -f option, so it won't ask any questions 796 ;; always pass patch the -f option, so it won't ask any questions
1768 (shell-command-on-region 797 (shell-command-on-region
1809 (rename-file (concat true-source-filename backup-extension) 838 (rename-file (concat true-source-filename backup-extension)
1810 true-source-filename t)) 839 true-source-filename t))
1811 840
1812 ;; make orig buffer read-only 841 ;; make orig buffer read-only
1813 (setq startup-hooks 842 (setq startup-hooks
1814 (cons 'ediff-toggle-read-only-patch-orig startup-hooks)) 843 (cons 'ediff-set-read-only-in-buf-A startup-hooks))
1815 844
1816 ;; set up a buf for the patched file 845 ;; set up a buf for the patched file
1817 (ediff-eval-in-buffer 846 (setq target-buf (find-file-noselect target-filename))
1818 (setq target-buf (find-file-noselect target-filename))
1819 ;; files to be patched are always checked out first
1820 (setq ediff-file-checked-out-flag t))
1821 847
1822 (ediff-buffers buf-to-patch target-buf startup-hooks 'epatch) 848 (setq ctl-buf
849 (ediff-buffers-internal
850 buf-to-patch target-buf nil
851 startup-hooks '(or job-name ediff-patch-file)))
1823 852
1824 (bury-buffer ediff-patch-diagnostics) 853 (bury-buffer ediff-patch-diagnostics)
1825 (message "Patch diagnostics available in buffer %s" 854 (message "Patch diagnostics are available in buffer %s"
1826 (buffer-name ediff-patch-diagnostics)))) 855 (buffer-name ediff-patch-diagnostics))
1827 856 ctl-buf))
1828 (defun ediff-toggle-read-only-patch-orig () 857
858 (defun ediff-set-read-only-in-buf-A ()
1829 "Used as a startup hook to set `_orig' patch file read-only." 859 "Used as a startup hook to set `_orig' patch file read-only."
1830 (ediff-toggle-read-only ediff-buffer-A)) 860 (ediff-eval-in-buffer ediff-buffer-A
861 (toggle-read-only 1)))
1831 862
1832 ;;;###autoload 863 ;;;###autoload
1833 (defalias 'epatch 'ediff-patch-file) 864 (defalias 'epatch 'ediff-patch-file)
1834 ;;;###autoload 865 ;;;###autoload
1835 (defalias 'epatch-buffer 'ediff-patch-buffer) 866 (defalias 'epatch-buffer 'ediff-patch-buffer)
1928 directory name should be returned. HOOKS is a variable symbol that will be 959 directory name should be returned. HOOKS is a variable symbol that will be
1929 assigned the hook to be executed after `ediff-startup' is finished. 960 assigned the hook to be executed after `ediff-startup' is finished.
1930 `ediff-find-file' arranges that the temp files it might create will be 961 `ediff-find-file' arranges that the temp files it might create will be
1931 deleted." 962 deleted."
1932 (let* ((file (symbol-value file-var)) 963 (let* ((file (symbol-value file-var))
1933 (file-magic (ediff-find-file-name-handler file)) 964 (file-magic (find-file-name-handler file 'find-file-noselect))
1934 (temp-file-name-prefix (file-name-nondirectory file))) 965 (temp-file-name-prefix (file-name-nondirectory file)))
1935 (if (not (file-readable-p file)) 966 (if (not (file-readable-p file))
1936 (error "File `%s' does not exist or is not readable" file)) 967 (error "File `%s' does not exist or is not readable" file))
1937 968
1938 ;; some of the command, below, require full file name 969 ;; some of the command, below, require full file name
2084 1115
2085 1116
2086 ;;; Compare regions and windows 1117 ;;; Compare regions and windows
2087 1118
2088 ;;;###autoload 1119 ;;;###autoload
2089 (defun ediff-windows (dumb-mode &optional wind-A wind-B startup-hooks) 1120 (defun ediff-windows-wordwise (dumb-mode &optional wind-A wind-B startup-hooks)
2090 "Compare WIND-A and WIND-B, which are selected by clicking. 1121 "Compare WIND-A and WIND-B, which are selected by clicking, wordwise.
2091 With prefix argument, DUMB-MODE, or on a non-windowing display, works as 1122 With prefix argument, DUMB-MODE, or on a non-windowing display, works as
2092 follows: 1123 follows:
2093 If WIND-A is nil, use selected window. 1124 If WIND-A is nil, use selected window.
2094 If WIND-B is nil, use window next to WIND-A." 1125 If WIND-B is nil, use window next to WIND-A."
2095
2096 (interactive "P") 1126 (interactive "P")
1127 (ediff-windows dumb-mode wind-A wind-B
1128 startup-hooks 'ediff-windows-wordwise 'word-mode))
1129
1130 ;;;###autoload
1131 (defun ediff-windows-linewise (dumb-mode &optional wind-A wind-B startup-hooks)
1132 "Compare WIND-A and WIND-B, which are selected by clicking, linewise.
1133 With prefix argument, DUMB-MODE, or on a non-windowing display, works as
1134 follows:
1135 If WIND-A is nil, use selected window.
1136 If WIND-B is nil, use window next to WIND-A."
1137 (interactive "P")
1138 (ediff-windows dumb-mode wind-A wind-B
1139 startup-hooks 'ediff-windows-linewise nil))
2097 1140
2098 (if (or dumb-mode (not window-system)) 1141 ;; Compare WIND-A and WIND-B, which are selected by clicking.
1142 ;; With prefix argument, DUMB-MODE, or on a non-windowing display,
1143 ;; works as follows:
1144 ;; If WIND-A is nil, use selected window.
1145 ;; If WIND-B is nil, use window next to WIND-A.
1146 (defun ediff-windows (dumb-mode wind-A wind-B startup-hooks job-name word-mode)
1147 (if (or dumb-mode (not (ediff-window-display-p)))
2099 (setq wind-A (ediff-get-next-window wind-A nil) 1148 (setq wind-A (ediff-get-next-window wind-A nil)
2100 wind-B (ediff-get-next-window wind-B wind-A)) 1149 wind-B (ediff-get-next-window wind-B wind-A))
2101 (setq wind-A (ediff-get-window-by-clicking wind-A nil 1) 1150 (setq wind-A (ediff-get-window-by-clicking wind-A nil 1)
2102 wind-B (ediff-get-window-by-clicking wind-B wind-A 2))) 1151 wind-B (ediff-get-window-by-clicking wind-B wind-A 2)))
2103 1152
2114 (select-window wind-B) 1163 (select-window wind-B)
2115 (setq beg-B (window-start) 1164 (setq beg-B (window-start)
2116 end-B (window-end)))) 1165 end-B (window-end))))
2117 (ediff-regions-internal 1166 (ediff-regions-internal
2118 buffer-A beg-A end-A buffer-B beg-B end-B 1167 buffer-A beg-A end-A buffer-B beg-B end-B
2119 startup-hooks 'ediff-windows 'word-mode))) 1168 startup-hooks job-name word-mode)))
2120 1169
2121 ;;;###autoload 1170 ;;;###autoload
2122 (defun ediff-small-regions (buffer-A buffer-B &optional startup-hooks) 1171 (defun ediff-regions-wordwise (buffer-A buffer-B &optional startup-hooks)
2123 "Run Ediff on a pair of regions in two different buffers. 1172 "Run Ediff on a pair of regions in two different buffers.
2124 Regions \(i.e., point and mark\) are assumed to be set in advance. 1173 Regions \(i.e., point and mark\) are assumed to be set in advance.
2125 This function is effective only for relatively small regions, up to 200 1174 This function is effective only for relatively small regions, up to 200
2126 lines. For large regions, use `ediff-large-regions'." 1175 lines. For large regions, use `ediff-regions-linewise'."
2127 (interactive 1176 (interactive
2128 (let (bf) 1177 (let (bf)
2129 (list (setq bf (read-buffer "Region's A buffer: " 1178 (list (setq bf (read-buffer "Region's A buffer: "
2130 (ediff-other-buffer "") t)) 1179 (ediff-other-buffer "") t))
2131 (read-buffer "Region's B buffer: " 1180 (read-buffer "Region's B buffer: "
2151 reg-B-end (region-end))) 1200 reg-B-end (region-end)))
2152 1201
2153 (ediff-regions-internal 1202 (ediff-regions-internal
2154 (get-buffer buffer-A) reg-A-beg reg-A-end 1203 (get-buffer buffer-A) reg-A-beg reg-A-end
2155 (get-buffer buffer-B) reg-B-beg reg-B-end 1204 (get-buffer buffer-B) reg-B-beg reg-B-end
2156 startup-hooks 'ediff-small-regions 'word-mode))) 1205 startup-hooks 'ediff-regions-wordwise 'word-mode)))
2157 1206
2158 ;;;###autoload 1207 ;;;###autoload
2159 (defun ediff-large-regions (buffer-A buffer-B &optional startup-hooks) 1208 (defun ediff-regions-linewise (buffer-A buffer-B &optional startup-hooks)
2160 "Run Ediff on a pair of regions in two different buffers. 1209 "Run Ediff on a pair of regions in two different buffers.
2161 Regions \(i.e., point and mark\) are assumed to be set in advance. 1210 Regions \(i.e., point and mark\) are assumed to be set in advance.
2162 Each region is enlarged to contain full lines. 1211 Each region is enlarged to contain full lines.
2163 This function is effective for large regions, over 100-200 1212 This function is effective for large regions, over 100-200
2164 lines. For small regions, use `ediff-small-regions'." 1213 lines. For small regions, use `ediff-regions-wordwise'."
2165 (interactive 1214 (interactive
2166 (let (bf) 1215 (let (bf)
2167 (list (setq bf (read-buffer "Region A's buffer: " 1216 (list (setq bf (read-buffer "Region A's buffer: "
2168 (ediff-other-buffer "") t)) 1217 (ediff-other-buffer "") t))
2169 (read-buffer "Region B's buffer: " 1218 (read-buffer "Region B's buffer: "
2207 ) ; save excursion 1256 ) ; save excursion
2208 1257
2209 (ediff-regions-internal 1258 (ediff-regions-internal
2210 (get-buffer buffer-A) reg-A-beg reg-A-end 1259 (get-buffer buffer-A) reg-A-beg reg-A-end
2211 (get-buffer buffer-B) reg-B-beg reg-B-end 1260 (get-buffer buffer-B) reg-B-beg reg-B-end
2212 startup-hooks 'ediff-large-regions nil))) ; no word mode 1261 startup-hooks 'ediff-regions-linewise nil))) ; no word mode
2213 1262
2214 ;; compare region beg-A to end-A of buffer-A 1263 ;; compare region beg-A to end-A of buffer-A
2215 ;; to regions beg-B -- end-B in buffer-B. 1264 ;; to regions beg-B -- end-B in buffer-B.
2216 (defun ediff-regions-internal (buffer-A beg-A end-A buffer-B beg-B end-B 1265 (defun ediff-regions-internal (buffer-A beg-A end-A buffer-B beg-B end-B
2217 startup-hooks job-name word-mode) 1266 startup-hooks job-name word-mode)
2485 ;;;###autoload 1534 ;;;###autoload
2486 (defun ediff-patch-buffer (buffer-name &optional startup-hooks) 1535 (defun ediff-patch-buffer (buffer-name &optional startup-hooks)
2487 "Run Ediff by patching BUFFER-NAME." 1536 "Run Ediff by patching BUFFER-NAME."
2488 (interactive "bBuffer to patch: ") 1537 (interactive "bBuffer to patch: ")
2489 1538
2490 (let* ((file-buffer (get-buffer buffer-name)) 1539 (let* ((buf-to-patch (get-buffer buffer-name))
2491 (file-name (if file-buffer (buffer-file-name file-buffer)))) 1540 (file-name-ok (if buf-to-patch (buffer-file-name buf-to-patch)))
2492 (if (not file-name) 1541 (buf-mod-status (buffer-modified-p buf-to-patch))
2493 (error "Buffer %s doesn't exist or doesn't visit any file. Why patch?" 1542 default-dir file-name ctl-buf)
2494 buffer-name)) 1543 (if file-name-ok
1544 (setq file-name file-name-ok)
1545 (ediff-eval-in-buffer buffer-name
1546 (setq default-dir default-directory)
1547 (setq file-name (ediff-make-temp-file))
1548 (set-visited-file-name file-name)
1549 (setq buffer-auto-save-file-name nil) ; don't create auto-save file
1550 (rename-buffer buffer-name) ; don't confuse the user with new buf name
1551 (set-buffer-modified-p nil)
1552 (set-visited-file-modtime) ; sync buffer and temp file
1553 (setq default-directory default-dir)
1554 ))
2495 1555
2496 (ediff-patch-file file-name startup-hooks))) 1556 (setq ctl-buf
1557 (ediff-patch-file file-name startup-hooks 'ediff-patch-buffer))
1558
1559 (if file-name-ok
1560 ()
1561 (ediff-eval-in-buffer ctl-buf
1562 (delete-file (buffer-file-name ediff-buffer-A))
1563 (delete-file (buffer-file-name ediff-buffer-B))
1564 (ediff-eval-in-buffer ediff-buffer-A
1565 (if default-dir (setq default-directory default-dir))
1566 (set-visited-file-name nil)
1567 (rename-buffer buffer-name)
1568 (set-buffer-modified-p buf-mod-status))
1569 (ediff-eval-in-buffer ediff-buffer-B
1570 (setq buffer-auto-save-file-name nil) ; don't create auto-save file
1571 (if default-dir (setq default-directory default-dir))
1572 (set-visited-file-name nil)
1573 (rename-buffer (ediff-unique-buffer-name
1574 (concat buffer-name "_patched") ""))
1575 (set-buffer-modified-p t))))
1576 ))
2497 1577
2498 1578
2499 (defun ediff-get-patch-buffer (dir) 1579 (defun ediff-get-patch-buffer (dir)
2500 "Obtain patch buffer. If patch is already in a buffer---use it. 1580 "Obtain patch buffer. If patch is already in a buffer---use it.
2501 Else, read patch file into a new buffer." 1581 Else, read patch file into a new buffer."
2503 (setq ediff-patch-buf 1583 (setq ediff-patch-buf
2504 (get-buffer (read-buffer "Patch buffer name: " nil t))) ;must match 1584 (get-buffer (read-buffer "Patch buffer name: " nil t))) ;must match
2505 (setq ediff-patch-buf 1585 (setq ediff-patch-buf
2506 (find-file-noselect (read-file-name "Patch file name: " dir)))) 1586 (find-file-noselect (read-file-name "Patch file name: " dir))))
2507 1587
2508 ;; secure the patch buffer against accidental changes
2509 (ediff-eval-in-buffer ediff-patch-buf
2510 (setq buffer-read-only t))
2511
2512 (setq ediff-patch-diagnostics 1588 (setq ediff-patch-diagnostics
2513 (get-buffer-create "*ediff patch diagnostics*")) 1589 (get-buffer-create "*ediff patch diagnostics*"))
2514 (ediff-eval-in-buffer 1590 (ediff-eval-in-buffer ediff-patch-diagnostics
2515 ediff-patch-diagnostics 1591 (insert-buffer ediff-patch-buf)))
2516 (insert-buffer ediff-patch-buf))
2517 )
2518 1592
2519 1593
2520 1594
2521 1595
2522 1596
2523 ;;; Versions Control functions 1597 ;;; Versions Control functions
2524 1598
2525 ;;;###autoload 1599 ;;;###autoload
2526 (defun ediff-revision (revision) 1600 (defun ediff-revision (arg)
2527 "Call `vc.el' or `rcs.el' depending on `ediff-version-control-package'. 1601 "Call `vc.el' or `rcs.el' depending on `ediff-version-control-package'.
2528 This function is introduced to provide a uniform interface to version 1602 Without prefix argument, compares the current buffer with an older version.
2529 control packages from Ediff." 1603 With prefix argument, compares two older versions of the current buffer."
2530 (interactive "sVersion to Ediff with (default: the latest version): ") 1604 (interactive "P")
2531 (ediff-load-version-control) 1605 (let (rev1 rev2)
2532 (funcall 1606 (if arg
2533 (intern (format "%S-ediff-internal" ediff-version-control-package)) 1607 (setq rev1
2534 revision)) 1608 (read-string
1609 "This buffer's version-1 to compare (default: the latest version): ")
1610 rev2
1611 (read-string "This buffer's version-2 to compare (default: the latest version): "))
1612 (setq rev1
1613 (read-string "Version to compare the current buffer with (default: the latest version): ")))
1614 (ediff-load-version-control)
1615 (funcall
1616 (intern (format "%S-ediff-internal" ediff-version-control-package))
1617 rev1 rev2)
1618 ))
2535 1619
2536 ;; Backward compatibility 1620 ;; Backward compatibility
2537 ;;;###autoload 1621 ;;;###autoload
2538 (defun vc-ediff () 1622 (defun vc-ediff ()
2539 (interactive) 1623 (interactive)
2561 (cond ((eq ediff-version-control-package 'vc) vc-prefix-map) 1645 (cond ((eq ediff-version-control-package 'vc) vc-prefix-map)
2562 ((eq ediff-version-control-package 'rcs) global-map) 1646 ((eq ediff-version-control-package 'rcs) global-map)
2563 (t global-map)) 1647 (t global-map))
2564 ediff-revision-key 'ediff-revision))) 1648 ediff-revision-key 'ediff-revision)))
2565 (or silent 1649 (or silent
2566 (error "Version control package %S.el not found. Use vc.el instead" 1650 (error "Version control package %S.el not found. Use vc.el instead"
2567 ediff-version-control-package))))) 1651 ediff-version-control-package)))))
2568 1652
2569 1653
2570 ;; Note: this function will work only with Emacs 19.22 or later. 1654 (defun vc-ediff-internal (rev1 &optional rev2)
2571 (defun vc-ediff-internal (rev) 1655 "Run Ediff on versions of the current buffer.
2572 "Run Ediff on version REV of the current buffer in another window. 1656 If both REV1 and REV2 are given then these two versions are compared.
1657 If only REV1 is given then the current buffer is compared against version REV1.
2573 If the current buffer is named `F', the version is named `F.~REV~'. 1658 If the current buffer is named `F', the version is named `F.~REV~'.
2574 If `F.~REV~' already exists, it is used instead of being re-created." 1659 If `F.~REV~' already exists, it is used instead of being re-created."
2575 (let ((newvers (current-buffer))) 1660 (let ((curbuf (current-buffer))
2576 (vc-version-other-window rev) 1661 (curwind (selected-window))
2577 ;; current-buffer is now supposed to contain the old version 1662 file1 file2
2578 ;; in another window 1663 rev1buf rev2buf)
2579 ;; We delete the temp file that was created by vc.el for the old 1664 (vc-version-other-window rev1)
2580 ;; version 1665 (setq rev1buf (current-buffer)
2581 (ediff-buffers (current-buffer) newvers 1666 file1 (buffer-file-name))
2582 (list (` (lambda () (delete-file (, (buffer-file-name)))))) 1667 (select-window curwind)
2583 'ediff-revision) 1668 (if (not (stringp rev2))
2584 )) 1669 (setq rev2buf curbuf)
1670 (vc-version-other-window rev2)
1671 (setq rev2buf (current-buffer)
1672 file2 (buffer-file-name)))
1673 (ediff-buffers
1674 rev1buf rev2buf
1675 (list (` (lambda ()
1676 (delete-file (, file1))
1677 (if (, file2) (delete-file (, file2)))
1678 )))
1679 'ediff-revision)))
2585 1680
2586 (defun rcs-ediff-view-revision (&optional rev) 1681 (defun rcs-ediff-view-revision (&optional rev)
2587 "View previous RCS revision of current file. 1682 "View previous RCS revision of current file.
2588 With prefix argument, prompts for a revision name." 1683 With prefix argument, prompts for a revision name."
2589 (interactive (list (if current-prefix-arg 1684 (interactive (list (if current-prefix-arg
2618 (setq buffer-read-only nil 1713 (setq buffer-read-only nil
2619 default-directory (file-name-directory (expand-file-name file))) 1714 default-directory (file-name-directory (expand-file-name file)))
2620 (erase-buffer)) 1715 (erase-buffer))
2621 buf)) 1716 buf))
2622 1717
2623 (defun rcs-ediff-internal (rev) 1718 (defun rcs-ediff-internal (rev1 &optional rev2)
2624 "Run Ediff on the current buffer, comparing it with previous RCS revision." 1719 "Run Ediff on the current buffer, comparing it with previous RCS revision."
2625 (let ((newvers (current-buffer)) 1720 (let ((rev2buf (if (stringp rev2)
2626 (oldvers (rcs-ediff-view-revision rev))) 1721 (rcs-ediff-view-revision rev2)
1722 (current-buffer)))
1723 (rev1buf (rcs-ediff-view-revision rev1)))
2627 1724
2628 ;; rcs.el doesn't create temp version files, so we don't have to delete 1725 ;; rcs.el doesn't create temp version files, so we don't have to delete
2629 ;; anything in startup hooks to ediff-buffers 1726 ;; anything in startup hooks to ediff-buffers
2630 (ediff-buffers oldvers newvers nil 'ediff-revision) 1727 (ediff-buffers rev1buf rev2buf nil 'ediff-revision)
2631 )) 1728 ))
2632 1729
2633 ;;; Menu bar 1730 ;;; Menu bar
2634 1731
2635 ;;; This is split in several parts to avoid 1732 ;;; This is split in several parts to avoid
2652 (symbol-value 'menu-bar-ediff-merge-menu)) 1749 (symbol-value 'menu-bar-ediff-merge-menu))
2653 (defvar menu-bar-ediff-menu (make-sparse-keymap "Ediff")) 1750 (defvar menu-bar-ediff-menu (make-sparse-keymap "Ediff"))
2654 (fset 'menu-bar-ediff-menu (symbol-value 'menu-bar-ediff-menu)) 1751 (fset 'menu-bar-ediff-menu (symbol-value 'menu-bar-ediff-menu))
2655 )) 1752 ))
2656 1753
1754 ;;; These must be placed in menu-bar.el in Emacs
1755 ;;
1756 ;; (define-key menu-bar-tools-menu [epatch]
1757 ;; '("Apply Patch" . menu-bar-epatch-menu))
1758 ;; (define-key menu-bar-tools-menu [ediff-merge]
1759 ;; '("Merge" . menu-bar-ediff-merge-menu))
1760 ;; (define-key menu-bar-tools-menu [ediff]
1761 ;; '("Compare" . menu-bar-ediff-menu))
1762
2657 1763
2658 ;;;###autoload 1764 ;;;###autoload
2659 (if purify-flag 1765 (if purify-flag
2660 ;; explicit string-match, as ediff-xemacs-p is not defined at build time 1766 ;; explicit string-match, as ediff-xemacs-p is not defined at build time
2661 (if (string-match "\\(Lucid\\|Xemacs\\)" emacs-version) 1767 (if (string-match "\\(Lucid\\|Xemacs\\)" emacs-version)
2662 () 1768 ()
2663 (define-key menu-bar-ediff-menu [ediff-revision] 1769 (define-key menu-bar-ediff-menu [ediff-revision]
2664 '("File with Revision ..." . ediff-revision)) 1770 '("File with Revision ..." . ediff-revision))
2665 (define-key menu-bar-ediff-menu [ediff-large-regions] 1771 (define-key menu-bar-file-menu [separator-ediff-files] '("--"))
2666 '("Large Regions ..." . ediff-large-regions))
2667 (define-key menu-bar-ediff-menu [ediff-small-regions]
2668 '("Small Regions ..." . ediff-small-regions))
2669 ;;; Too confusing to have this and compare-windows in the same menu.
2670 ;; (define-key menu-bar-ediff-menu [ediff-windows]
2671 ;; '("Windows ..." . ediff-windows))
2672 ))
2673
2674 ;;;###autoload
2675 (if purify-flag
2676 ;; explicit string-match, as ediff-xemacs-p is not defined at build time
2677 (if (string-match "\\(Lucid\\|Xemacs\\)" emacs-version)
2678 ()
2679 (define-key menu-bar-ediff-menu [ediff-buffers3] 1772 (define-key menu-bar-ediff-menu [ediff-buffers3]
2680 '("Three Buffers ..." . ediff-buffers3)) 1773 '("Three Buffers ..." . ediff-buffers3))
2681 (define-key menu-bar-ediff-menu [ediff-files3] 1774 (define-key menu-bar-ediff-menu [ediff-files3]
2682 '("Three Files ..." . ediff-files3)) 1775 '("Three Files ..." . ediff-files3))
2683 (define-key menu-bar-ediff-menu [ediff-buffers] 1776 (define-key menu-bar-ediff-menu [ediff-buffers]
2689 ;;;###autoload 1782 ;;;###autoload
2690 (if purify-flag 1783 (if purify-flag
2691 ;; explicit string-match, as ediff-xemacs-p is not defined at build time 1784 ;; explicit string-match, as ediff-xemacs-p is not defined at build time
2692 (if (string-match "\\(Lucid\\|Xemacs\\)" emacs-version) 1785 (if (string-match "\\(Lucid\\|Xemacs\\)" emacs-version)
2693 () 1786 ()
1787 (define-key menu-bar-file-menu [separator-ediff-regions] '("--"))
1788 (define-key menu-bar-ediff-menu [ediff-regions-linewise]
1789 '("Regions Line-by-line ..." . ediff-regions-linewise))
1790 (define-key menu-bar-ediff-menu [ediff-regions-wordwise]
1791 '("Regions Word-by-word ..." . ediff-regions-wordwise))
1792 (define-key menu-bar-file-menu [separator-ediff-windows] '("--"))
1793 (define-key menu-bar-ediff-menu [ediff-windows-linewise]
1794 '("Windows Line-by-line ..." . ediff-windows-linewise))
1795 (define-key menu-bar-ediff-menu [ediff-windows-wordwise]
1796 '("Windows Word-by-word ..." . ediff-windows-wordwise))
1797 ))
1798
1799 ;;;###autoload
1800 (if purify-flag
1801 ;; explicit string-match, as ediff-xemacs-p is not defined at build time
1802 (if (string-match "\\(Lucid\\|Xemacs\\)" emacs-version)
1803 ()
2694 (define-key 1804 (define-key
2695 menu-bar-ediff-merge-menu [ediff-merge-revisions-with-ancestor] 1805 menu-bar-ediff-merge-menu [ediff-merge-revisions-with-ancestor]
2696 '("Revisions with Ancestor ..." . ediff-merge-revisions-with-ancestor)) 1806 '("Revisions with Ancestor ..." . ediff-merge-revisions-with-ancestor))
2697 (define-key menu-bar-ediff-merge-menu [ediff-merge-revisions] 1807 (define-key menu-bar-ediff-merge-menu [ediff-merge-revisions]
2698 '("Revisions ..." . ediff-merge-revisions)) 1808 '("Revisions ..." . ediff-merge-revisions))
1809 (define-key menu-bar-file-menu [separator-ediff-merge] '("--"))
2699 (define-key menu-bar-ediff-merge-menu [ediff-merge-buffers-with-ancestor] 1810 (define-key menu-bar-ediff-merge-menu [ediff-merge-buffers-with-ancestor]
2700 '("Buffers with Ancestor ..." . ediff-merge-buffers-with-ancestor)) 1811 '("Buffers with Ancestor ..." . ediff-merge-buffers-with-ancestor))
2701 (define-key menu-bar-ediff-merge-menu [ediff-merge-buffers] 1812 (define-key menu-bar-ediff-merge-menu [ediff-merge-buffers]
2702 '("Buffers ..." . ediff-merge-buffers)) 1813 '("Buffers ..." . ediff-merge-buffers))
2703 (define-key menu-bar-ediff-merge-menu [ediff-merge-files-with-ancestor] 1814 (define-key menu-bar-ediff-merge-menu [ediff-merge-files-with-ancestor]
2722 (if purify-flag 1833 (if purify-flag
2723 ;; explicit string-match, as ediff-xemacs-p is not defined at build time 1834 ;; explicit string-match, as ediff-xemacs-p is not defined at build time
2724 (if (string-match "\\(Lucid\\|Xemacs\\)" emacs-version) 1835 (if (string-match "\\(Lucid\\|Xemacs\\)" emacs-version)
2725 (progn 1836 (progn
2726 (defvar ediff-menu 1837 (defvar ediff-menu
2727 '("" 1838 '("Compare"
2728 ["Two Files ..." ediff-files t] 1839 ["Two Files ..." ediff-files t]
2729 ["Two Buffers ..." ediff-buffers t] 1840 ["Two Buffers ..." ediff-buffers t]
2730 ["Three Files ..." ediff-files3 t] 1841 ["Three Files ..." ediff-files3 t]
2731 ["Three Buffers ..." ediff-buffers3 t] 1842 ["Three Buffers ..." ediff-buffers3 t]
2732 ["Windows ..." ediff-windows t] 1843 "---"
2733 ["Small Regions ..." ediff-small-regions t] 1844 ["File with Revision ..." ediff-revision t]
2734 ["Large Regions ..." ediff-large-regions t] 1845 "---"
2735 ["File with Revision ..." ediff-revision t])) 1846 ["Windows Word-by-word ..." ediff-windows-wordwise t]
1847 ["Windows Line-by-line ..." ediff-windows-linewise t]
1848 "---"
1849 ["Regions Word-by-word ..." ediff-regions-wordwise t]
1850 ["Regions Line-by-line ..." ediff-regions-linewise t]))
2736 (defvar ediff-merge-menu 1851 (defvar ediff-merge-menu
2737 '("" 1852 '("Merge"
2738 ["Files ..." ediff-merge-files t] 1853 ["Files ..." ediff-merge-files t]
2739 ["Files with Ancestor ..." ediff-merge-files-with-ancestor t] 1854 ["Files with Ancestor ..." ediff-merge-files-with-ancestor t]
2740 ["Buffers ..." ediff-merge-buffers t] 1855 ["Buffers ..." ediff-merge-buffers t]
2741 ["Buffers with Ancestor ..." 1856 ["Buffers with Ancestor ..."
2742 ediff-merge-buffers-with-ancestor t] 1857 ediff-merge-buffers-with-ancestor t]
1858 "---"
2743 ["Revisions ..." ediff-merge-revisions t] 1859 ["Revisions ..." ediff-merge-revisions t]
2744 ["Revisions with Ancestor ..." 1860 ["Revisions with Ancestor ..."
2745 ediff-merge-revisions-with-ancestor t])) 1861 ediff-merge-revisions-with-ancestor t]))
2746 (defvar epatch-menu 1862 (defvar epatch-menu
2747 '("" 1863 '("Apply Patch"
2748 ["To a file ..." ediff-patch-file t] 1864 ["To a file ..." ediff-patch-file t]
2749 ["To a buffer ..." ediff-patch-buffer t])) 1865 ["To a buffer ..." ediff-patch-buffer t]))
2750 (add-menu '("File") "Compare" 1866 (add-submenu '("Tools") ediff-menu "VC")
2751 ediff-menu 1867 (add-submenu '("Tools") ediff-merge-menu "VC")
2752 "New Frame") 1868 (add-submenu '("Tools") epatch-menu "VC")
2753 (add-menu '("File") "Merge"
2754 ediff-merge-menu
2755 "New Frame")
2756 (add-menu '("File") "Apply Patch"
2757 epatch-menu
2758 "New Frame")
2759 ;; Display a solid horizontal line 1869 ;; Display a solid horizontal line
2760 (add-menu-item '("File") "---" nil nil "New Screen") 1870 (add-menu-button '("Tools") ["---" nil nil] "VC")
2761 ))) 1871 )))
2762 1872
2763 1873
2764 (provide 'ediff) 1874 (provide 'ediff)
2765 (require 'ediff-util) 1875 (require 'ediff-util)