ediff.el 174 KB
Newer Older
Richard M. Stallman's avatar
Richard M. Stallman committed
1 2 3 4 5
;;; ediff.el --- a visual interface to diff & patch
;;; Copyright (C) 1994 Free Software Foundation, Inc.

;; Author: Michael Kifer <kifer@cs.sunysb.edu>
;; Created: February 2, 1994
6
;; Version: 1.65e
7
;; Keywords: comparing, merging, patching, version control.
Richard M. Stallman's avatar
Richard M. Stallman committed
8

9 10 11
(defvar ediff-version "1.65e" "The current version of Ediff")
(defvar ediff-date "September 1, 1994" "Date of last update")  

Richard M. Stallman's avatar
Richard M. Stallman committed
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
;; This file is part of GNU Emacs.

;; GNU Emacs is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.

;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING.  If not, write to
;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.


;;; Commentary:
;;  ----------

Richard M. Stallman's avatar
Richard M. Stallman committed
32 33
;; Never read those diff outputs again!
;; Apply patch selectively, like a pro!
Richard M. Stallman's avatar
Richard M. Stallman committed
34

35
;; This package provides a convenient way of simultaneous browsing through
Richard M. Stallman's avatar
Richard M. Stallman committed
36 37 38 39 40 41 42 43
;; the differences between a pair of files or buffers.  The two files being
;; compared (file-A and file-B) are shown in separate windows (side by
;; side, one above the another, or in separate frames), and the differences
;; are highlighted as you step through them.  You can also copy difference
;; regions from one buffer to another (and recover old differences if you
;; change your mind).

;; In addition, Ediff can apply a patch to a file and then let you step
44
;; though both files, the patched and the original one, simultaneously,
Richard M. Stallman's avatar
Richard M. Stallman committed
45 46 47 48 49 50 51
;; difference-by-difference.  You can even apply a patch right out of a
;; mail buffer, i.e., patches received by mail don't even have to be saved.
;; Since Ediff lets you copy differences between buffers, you can, in
;; effect, apply patches selectively (i.e., you can copy a difference
;; region from file.orig to file, thereby undoing any particular patch that
;; you don't like).

Richard M. Stallman's avatar
Richard M. Stallman committed
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
;; This package builds upon the ideas borrowed from emerge.el.  It is still
;; using half a dozen of functions defined there. Several other Ediff's
;; functions are adaptations from emerge.el. Ediff requires, at least, 
;; Version 5 of emerge.el. This version comes with standard distributions
;; of Emacs and Lemacs.  Make sure you don't have some stray old copy of
;; Emerge on your load path.

;; Ediff is complimentary to Emerge.  While Emerge is primarily intended
;; for merging of files, Ediff is by far superior for browsing through
;; files compared via diff and for patching files with patch.
;; Furthermore, Ediff is more convenient even for merging, when one of the
;; files is a designated output.  This situation arises while patching
;; files or when comparing an old version of a file with a newer version
;; (in such cases, it is often desirable to selectively revert some
;; portions of the new file to its old state).

;; Ediff also supports version control via vc.el (in the standard
;; distribution of Emacs 19) and rcs.el. The latter is a package written by 
;; Sebastian Kremer <sk@thp.Uni-Koeln.DE>, which is available in
;;
;;         ftp.cs.buffalo.edu:pub/Emacs/rcs.tar.Z
;;         ftp.uni-koeln.de:/pub/gnu/emacs/rcs.tar.Z
;;
75 76 77 78
;; To specify which version control package you are using, set the variable
;; ediff-version-control-package, e.g.,
;;	(setq ediff-version-control-package 'rcs)
;; The default, is 'vc'.
Richard M. Stallman's avatar
Richard M. Stallman committed
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105


;; Window configuration:
;; ----------------------

;; By default, Ediff sets things up in one frame, splitting it between a
;; small control window and the two windows for file-A and file-B.  The
;; split between these latter windows can be horizontal or vertical, which
;; can be changed interactively by hitting 's' while the cursor is in the
;; control window.
;;
;; In a multi-frame situation, Ediff would work as follows.  When it starts,
;; it will place the control window in the frame that was selected at the
;; time of the invocation.  If file-A or file-B is seen in one of the
;; frames, Ediff will leave it there.  If a file (A/B) is not visible in any
;; frame, Ediff will arrange that it will share a frame with the control
;; window. (If none of the files is visible, then both will share the
;; control window frame.) The same algorithm works when you hit 'c'
;; (ediff-recenter), 'p' (ediff-previous-difference), 'n', etc.
;;
;; Thus, you can compare files in one frame or in different frames.
;; The former is done by default, while the latter can be achieved by
;; arranging files A and B to be seen in different frames.  Ediff
;; respects these arrangements, automatically adapting itself to 
;; the multi-frame mode.


Richard M. Stallman's avatar
Richard M. Stallman committed
106
;; To those who like to go where noone has gone before:
Richard M. Stallman's avatar
Richard M. Stallman committed
107 108 109 110 111 112

;;  Ediff lets the user run multiple sessions at once, i.e., you can invoke
;;  Ediff on different functions several times in a row, without exiting
;;  the previous Ediff sessions. Different sessions may even operate on the
;;  same pair of files.  So, in principle, it is possible to do, say,
;;  pairwise comparison of three (or more) different files.  Each session
113 114
;;  would have its own Ediff Control Panel and all the regarding a
;;  particular session is local to the associated control panel buffer.
Richard M. Stallman's avatar
Richard M. Stallman committed
115
;;  You can switch between sessions by suspending one session and then
116 117 118
;;  switching to another control panel. (Different control panel buffers
;;  are distinguished by a numerical suffix, e.g., Ediff Control Panel<3>.)
;;  Thus, if you would like to compare three files pairwise, you can do
Richard M. Stallman's avatar
Richard M. Stallman committed
119 120 121 122 123 124 125 126 127 128
;;  this by preparing three different frames, each with its own control
;;  window.  (This would require a very wide screen, and I never claimed
;;  that such 3-way comparison is very easy to do.)
;;
;; If you need to conduct multiple Ediff sessions on the same file, one
;; thing should be kept in mind: each time you invoke Ediff on a buffer that
;; already participates in another Ediff session, that buffer should not
;; have any ASCII Ediff flags in it. (Highlighting with faces is OK.)  If
;; flags are not removed, difference overlays won't be set correctly
;; for the second invocation of Ediff.  The simplest way to remove ASCII
Richard M. Stallman's avatar
Richard M. Stallman committed
129 130
;; flags from an Ediff buffer is to hit `h' and thus switch to highlighting
;; with faces (unhighlighting on a dumb terminal).
Richard M. Stallman's avatar
Richard M. Stallman committed
131

132 133 134
;;;  Remote and Compressed Files
;;   ---------------------------

135 136 137 138 139 140
;;  Ediff will work with remote, compressed, and encrypted files. Ediff
;;  supports ange-ftp.el, jka-compr.el, uncompress.el and crypt++.el, but
;;  it may work with other similar packages as well. This
;;  means that you can compare files residing on another machine, or you
;;  can apply a patch to a file on another machine (even the patch itself
;;  can be a remote file!).
141
;;
142 143 144 145 146 147 148
;;  When patching compressed or remote files, Ediff doesn't rename the
;;  source file into source-file-name.orig (unlike what `patch' would
;;  usually do). Instead, the source file retains its name and the result
;;  of applying the patch is placed in a temporary file that has the suffix
;;  `.patched'.  Generally, this applies to files that are handled using
;;  black magic, such as special file handlers (ange-ftp and some
;;  compression and encryption packages all use this method).
149 150 151 152 153
;;
;;  Regular files are treated by `patch' in the usual manner, i.e., the
;;  original is renamed into source-name.orig and the result of the patch
;;  is placed into the file source-name.

Richard M. Stallman's avatar
Richard M. Stallman committed
154 155 156 157

;;; Remarks: 
;;  -------

Richard M. Stallman's avatar
Richard M. Stallman committed
158 159
;;  1. Ediff is heavily dependent on the new features of Emacs 19.
;;     It won't run under Emacs 18 at all.
Richard M. Stallman's avatar
Richard M. Stallman committed
160
;;  2. If running Lucid Emacs, Ediff requires at least version 19.9.
161 162
;;  3. The function ediff-revision requires the version of vc.el that comes
;;     with Emacs 19.22 and later, or rcs.el version 1.67 or later.
Richard M. Stallman's avatar
Richard M. Stallman committed
163 164 165 166 167 168 169 170


;;; Installation and use:
;;  --------------------

;; You can invoke Ediff interactively using the following functions:
;;
;;  	    ediff-buffers   	    	    	 - compare buffers
171
;;  	    ediff   	    	    	    	 - alias for ediff-files)
Richard M. Stallman's avatar
Richard M. Stallman committed
172 173
;;  	    ediff-files   	    	    	 - compare files
;;  	    ediff-patch-file	    	    	 - patch file then compare
Richard M. Stallman's avatar
Richard M. Stallman committed
174
;;  	    epatch  	    	    	    	 - alias for ediff-patch-file
Richard M. Stallman's avatar
Richard M. Stallman committed
175
;;  	    ediff-patch-buffer	    	    	 - patch buffer then compare
Richard M. Stallman's avatar
Richard M. Stallman committed
176
;;  	    epatch-buffer   	    	    	 - alias for ediff-patch-buffer
177
;;  	    ediff-revision 	    	    	 - compare buffer & version
Richard M. Stallman's avatar
Richard M. Stallman committed
178 179 180 181
;;
;;
;; To use Ediff, put this in your .emacs file:
;;
Richard M. Stallman's avatar
Richard M. Stallman committed
182 183 184 185 186 187
;;  (autoload 'ediff-buffers "ediff" "Visual interface to diff" t)
;;  (autoload 'ediff  "ediff"  "Visual interface to diff" t)
;;  (autoload 'ediff-files "ediff" "Visual interface to diff" t)
;;  (autoload 'epatch  "ediff"  "Visual interface to patch" t)
;;  (autoload 'ediff-patch-file "ediff" "Visual interface to patch" t)
;;  (autoload 'ediff-patch-buffer "ediff" "Visual interface to patch" t)
Richard M. Stallman's avatar
Richard M. Stallman committed
188
;;  (autoload 'epatch-buffer "ediff" "Visual interface to patch" t)
189 190
;;  (autoload 'ediff-revision "ediff"
;;  	    	    	"Interface to diff & version control" t) 
Richard M. Stallman's avatar
Richard M. Stallman committed
191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206
;;
;;
;; If you want Ediff to be loaded from the very beginning, you should have
;;
;;  (require 'ediff)
;;
;; in your .emacs file.  This way it is also easier to figure out changes
;; to the default Ediff setting, if such changes become necessary --- see
;; Customization.
;;

;;; Compilation
;;  -----------
;;
;; When you byte-compile Ediff, you will get some warnings about functions
;; being undefined.  These can be safely ignored.
Richard M. Stallman's avatar
Richard M. Stallman committed
207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222
;;
;;   Important:
;;   =========
;;
;;    If you are using advice.el (directly or indirectly, via one of the
;;    other packages), Ediff may not compile properly.  In this case, you
;;    should do:
;;
;;    	  M-x ad-deactivate-all RET
;;
;;  	  M-x byte-compile-file RET ediff.el RET
;;
;;  	  M-x ad-activate-all RET
;;
;;    This precaution will not be needed starting with GNU Emacs 19.23 and
;;    Lucid Emacs 19.10, due to fixing a bug in advice.el.
Richard M. Stallman's avatar
Richard M. Stallman committed
223 224 225 226

;;; Customization:
;;  -------------

Richard M. Stallman's avatar
Richard M. Stallman committed
227 228
;; Hooks:
;; -----
Richard M. Stallman's avatar
Richard M. Stallman committed
229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247
;; If you don't like the default setting, you can change it through the
;; various variables and hooks.  In particular, the following hooks are
;; available: 

;;	    ediff-load-hooks
;;  	    ediff-before-setup-windows-hooks
;;  	    ediff-startup-hooks
;;  	    ediff-select-hooks
;;  	    ediff-unselect-hooks
;;  	    ediff-suspend-hooks
;;  	    ediff-quit-hooks
;;  	    ediff-prepare-buffer-hooks

;; The hooks in ediff-load-hooks can be used to change defaults after Ediff
;; is loaded.
;; The hooks in ediff-before-setup-windows-hooks, ediff-suspend-hooks, and
;; ediff-quit-hooks can be used to save and then restore whatever window
;; configuration you want.  However, make sure you understand what you are
;; doing.  Many variables that drive Ediff are local to the different
248
;; Ediff Control Panel buffers.  Take a look at ediff-default-suspend-hook and
Richard M. Stallman's avatar
Richard M. Stallman committed
249 250 251 252
;; ediff-default-quit-hook to see what's involved.
;; The hooks in ediff-prepare-buffer-hooks are executed for each Ediff buffer
;; (A and B) right after these buffers are arranged.
;;
253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297
;;
;; Selective browsing: Control over stepping through difference regions
;; ----------------------------------------------- 
;;
;; Sometimes it is convenient to be able to step through only some
;; difference regions, those that satisfy certain conditions and to ignore
;; all others. The commands `#f' and `#h' let the user specify regular
;; expressions to control the way Ediff skips to the next or previous
;; difference. Typing `#f' lets one specify a pair of regular expressions,
;; regexp-A and regexp-B.
;; Ediff will then start stepping only through those difference regions where
;; the region in buffer A matches regexp-A and the region in buffer B
;; matches regexp-B.
;; Similarly, using `#h', one specifies expressions that match difference
;; regions to be ignored while stepping through the differences. That is, if
;; the buf A part matches regexp-A and the buf B part matches regexp B then
;; the region will be ignored by ediff-next-difference and
;; ediff-previous-difference commands.
;;
;;  Hitting `#f' and `#h' toggles this feature on/off.
;;
;; Note that selective browsing affects only ediff-next-difference and
;; ediff-previous-difference, i.e., the commands invoked by typing n/SPC
;; and p/DEL. You can still jump directly (using `j' or `ga/gb') to any
;; numbered  difference. Also, it should be understood, that #f and #h do
;; not change the position of the point in the buffers. The effect of these
;; commands is seen only when the user types `n' or `p', i.e., when
;; Ediff is told to jump to the next or previous difference.
;;
;; Users can supply their own functions that specify how Ediff should do
;; selective browsing. To change the default Ediff function, add a function to
;; ediff-load-hooks which will do the following assignments:
;;
;;  	(fset ediff-hide-regexp-matches 'your-hide-function) 
;;  	(fset ediff-focus-on-regexp-matches 'your-focus-function)
;;
;; Useful hints: To specify a regexp that matches everything, don't simply
;; type RET in response to a prompt. Typing RET tells Ediff to accept the
;; default value, which may not be what you want. Instead, one should enter
;; something like `^' or `$' --- which would match every line. 
;;
;; If the user doesn't remember if selective browsing is in effect and
;; which regexps are being used, the status command, `i', will supply
;; the requisite information.
;;
298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318
;; In addition to the ability to ignore regions that match regular
;; expressions, Ediff can be ordered to start skipping over certain
;; `inessential' regions. This is controlled by the variable
;;
;;      ediff-ignore-similar-regions
;;
;; which, if set to t, will cause Ediff to skip over difference regions
;; that has been found similar, i.e., where the only differences are those
;; in the white space and newlines.
;;
;; Note: In order for this feature to work, auto-refining of difference
;; regions must be on, since otherwise Ediff won't know if there are no
;; fine differences between regions. Under X, auto-refining is a default,
;; but it is nixed on a dumb terminal or in an Xterm window. Therefore, in
;; a non-windowing environment, the user must explicitly turn
;; auto-refining on (e.g., by typing `@').
;;
;; CAUTION: If many inessential regions appear in a row, Ediff may take a
;; long time to jump to the next region because it has to compute fine
;; differences of all intermediate regions.
;;
319 320 321
;;
;; Highlighting difference regions
;; -------------------------------
Richard M. Stallman's avatar
Richard M. Stallman committed
322 323 324 325 326 327 328 329 330 331
;; The second group of Ediff variables that could be changed, if you so
;; wish, is: 
;;
;;  	    ediff-before-flag-eol
;;  	    ediff-after-flag-eol
;;  	    ediff-before-flag-mol
;;  	    ediff-after-flag-mol
;;
;;  	    ediff-current-diff-face-A
;;  	    ediff-current-diff-face-B
Richard M. Stallman's avatar
Richard M. Stallman committed
332 333
;;  	    ediff-fine-diff-face-A
;;  	    ediff-fine-diff-face-B
Richard M. Stallman's avatar
Richard M. Stallman committed
334 335 336 337 338 339 340 341 342 343 344 345 346
;;  	    ediff-even-diff-face-A
;;  	    ediff-even-diff-face-B
;;  	    ediff-odd-diff-face-A
;;  	    ediff-odd-diff-face-B
;
;; The first four are ASCII strings that mark the beginning and the end of
;; the differences found in file-A and file-B. Ediff uses different flags
;; to highlight regions that begin/end at the beginning of a line or in a
;; middle of a line.

;; The rest are the faces used to highlight text on X displays.  On X
;; displays, Ediff uses ediff-current-diff-face-A and
;; ediff-current-diff-face-B to highlight the current difference regions.
Richard M. Stallman's avatar
Richard M. Stallman committed
347 348 349
;; The faces ediff-fine-diff-face-A and ediff-fine-diff-face-B
;; are used to show the fine differences between the current differences
;; regions in buffer A and B.
Richard M. Stallman's avatar
Richard M. Stallman committed
350
;; Other (non-current) difference regions are displayed in alternating
Richard M. Stallman's avatar
Richard M. Stallman committed
351
;; faces: ediff-even/odd-diff-face-A/B.   The odd and the even
Richard M. Stallman's avatar
Richard M. Stallman committed
352
;; faces are actually identical on monochrome displays, because it is
Richard M. Stallman's avatar
Richard M. Stallman committed
353
;; rather poor in what you can do on such a display. So, I chose to use
354
;; italics to highlight other differences. Any ideas would be welcome.
Richard M. Stallman's avatar
Richard M. Stallman committed
355 356 357
;; There are two ways to change the default setting for highlighting faces:
;; either change the variables, as in
;;
358 359 360 361 362 363
;; (setq ediff-current-diff-face-A 'bold-italic)
;;
;; or
;;
;; (setq ediff-current-diff-face-A
;;  	 (copy-face 'bold-italic 'ediff-current-diff-face-A))
Richard M. Stallman's avatar
Richard M. Stallman committed
364 365 366 367 368 369 370 371 372 373 374 375
;;
;; or by selectively modifying the defaults:
;;
;; (add-hook 'ediff-load-hooks
;;   (function (lambda () 
;;                (set-face-foreground ediff-current-diff-face-B "blue")
;;                (set-face-background ediff-current-diff-face-B "red")
;;                (make-face-italic ediff-current-diff-face-B))))
;;
;; You may also want to take a look at how the above faces are defined in
;; Ediff. 
;;
376 377 378 379 380
;; Note: it is not recommended to use `internal-get-face' (or `get-face' in
;;  	 Lucid) when defining faces for Ediff, since this may cause
;;  	 problems when there are several frames with different font sizes.
;;       Instead, use copy-face or set/make-face-* as shown above.
;;
Richard M. Stallman's avatar
Richard M. Stallman committed
381
;; The last group of variables in this group,
Richard M. Stallman's avatar
Richard M. Stallman committed
382 383
;;
;;  	    ediff-want-faces
Richard M. Stallman's avatar
Richard M. Stallman committed
384 385
;;  	    ediff-highlight-all-diffs
;;  	    ediff-want-default-menus
Richard M. Stallman's avatar
Richard M. Stallman committed
386 387 388 389 390
;;
;; indicate whether---on a window system---you want differences to be
;; marked using ASCII strings (like on a dumb terminal) or using colors and
;; highlighting. If ediff-want-faces is t, then highlighting with faces is
;; used. Normally, Ediff highlights all differences, but the selected
Richard M. Stallman's avatar
Richard M. Stallman committed
391 392 393 394 395 396 397 398 399 400 401
;; difference is highlighted more visibly. You can cycle through various
;; modes of highlighting by hitting `h'. By default, Ediff starts in the
;; mode where all difference regions are highlighted. If you prefer to
;; start in the mode where unselected differences are not highlighted, you
;; should set ediff-highlight-all-diffs to nil. 
;; You will still be able to turn on highlighting of all differences by
;; hitting `h'.
;; The variable `ediff-want-default-menus', if true, will cause Ediff to
;; set up a pair of menues in the menu bar, so you can invoke it from there.
;; If you don't like the look of the default menus, set this variable to
;; nil and design your own menus.
Richard M. Stallman's avatar
Richard M. Stallman committed
402 403 404 405 406 407 408 409 410 411
;;
;; If you plan on changing these variables, they must be set
;; BEFORE ediff.el is loaded. 
;;
;; Note: Ediff lets you switch between the two types of highlighting.  That
;; is you can switch, interactively, from highlighting using faces to
;; highlighting using ASCII flags, and back.  Of course, toggling has
;; effect only on a window system.  On a dumb terminal or in an xterm
;; window, the only available option is highlighting with ASCII flags.
;;
Richard M. Stallman's avatar
Richard M. Stallman committed
412 413
;; Refining difference regions
;; ---------------------------
414 415
;; Ediff has variables that control the way fine differences are
;; highlighted. This feature lets the user highlight the exact words that 
Richard M. Stallman's avatar
Richard M. Stallman committed
416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438
;; make the difference regions in buffer A and B different. This process
;; ignores spaces, tabs, and newlines.
;;
;;  	    ediff-auto-refine
;;  	    ediff-auto-refine-limit
;;
;; By default, `ediff-auto-refine' is `'on', which means that fine differences
;; within regions will be highlighted automatically. On a slow system, this
;; feature may be undesirable. In any case, the user can always toggle
;; auto-refining on/off/nix by hitting `@'. When auto-refining is off, fine
;; differences will be shown only for regions for which these differences
;; have been computed and saved before. If auto-refining is nixed, fine
;; differences will not be shown at all. Hitting `*' will compute and
;; display fine differences for the current difference region regardless of
;; whether auto-refining is on, off, or nixed. 
;; If auto-refining is on, the variable `ediff-auto-refine-limit' limits
;; the size of the regions to be auto-refined. This variable guards against
;; possible slow-down that may be caused by an extraordinary large
;; difference region. However, the user can always force refining by
;; hitting `*'.
;;
;;  	    ediff-fine-diff-program
;;  	    ediff-fine-diff-options
439
;;  	    ediff-forward-word-function
Richard M. Stallman's avatar
Richard M. Stallman committed
440 441 442 443
;;
;; These variables let the user control how fine differences are computed.
;; `ediff-fine-diff-program' is diff, by default. However, you can use
;; any function as long as it produces output consistent with diff.
444
;; `ediff-forward-word-function' is a lisp function that determines how the
Richard M. Stallman's avatar
Richard M. Stallman committed
445 446 447
;; current difference region is split into words. (Fine diferences are
;; computed by first splitting the current difference region into words and
;; then passing this along to `ediff-fine-diff-program'. For the default
448
;; wordify function, `ediff-forward-word', a word is a string consisting of
Richard M. Stallman's avatar
Richard M. Stallman committed
449 450 451 452 453 454 455 456
;; letters, `-', or `_', or a string consisting of symbols that are neither
;; space, nor a letter.)
;;
;; Patch and diff programs
;; -----------------------
;; The next group of variables determines the programs to be used for
;; applying patches and for computing the main difference regions (not the
;; fine difference regions):
Richard M. Stallman's avatar
Richard M. Stallman committed
457 458 459 460 461 462 463 464 465 466 467 468
;;
;;  	    ediff-patch-program
;;  	    ediff-patch-options
;;  	    ediff-diff-program
;;  	    ediff-diff-options
;;
;; These specify the functions that produce differences and do patching.
;; The *-options variables specify which options to pass to these programs.
;; It is unlikely that you would want to change these.  One possible
;; exception is when you may want to generate differences with context
;; lines in order to send a patch file through email.  Then, you might want
;; to set ediff-diff-options to '-c'. Sometimes, you may also want to tell
Richard M. Stallman's avatar
Richard M. Stallman committed
469
;; diff to ignore spaces and such. Use the option '-w' for that. Diff
Richard M. Stallman's avatar
Richard M. Stallman committed
470 471
;; has several other useful options (type 'man diff' to find out).
;;
472 473 474 475 476 477
;; The output from diff is found in *ediff-diff* buffer, which you can save.
;; However, using Ediff for producing a diff output makes sense only if you
;; also intend to use Ediff to browse through the diff'ed files before
;; sending the patch.  This is because diff.el, which also comes with
;; Emacs, is much faster in yielding the output of diff  (Ediff is a big
;; gun, if used for this simple purpose).
Richard M. Stallman's avatar
Richard M. Stallman committed
478
;;
479 480 481 482 483 484 485 486 487 488 489 490 491 492 493
;; Mode line
;; ---------
;;
;; When Ediff is running, the mode line of Ediff Control Panel buffer
;; displays the current difference being displayed and the total number of
;; difference regions in the two files. 
;;
;; The mode line of the buffers being compared displays the type of the
;; buffer (`A:' or `B:') and (usually) the file name. Ediff is trying to be
;; intelligent in choosing mode line buffer identification. In particular,
;; it works well with uniquify.el and mode-line.el packages (which improve
;; on the default way in which Emacs displays buffer identification).
;; If you don't like the way Ediff identifies its buffers, there is always
;; ediff-prepare-buffer-hooks, which can be used to modify the mode line.
;;
Richard M. Stallman's avatar
Richard M. Stallman committed
494 495
;; Miscellaneous
;; -------------
Richard M. Stallman's avatar
Richard M. Stallman committed
496 497 498 499
;; The last set of variables that can be modified is
;;
;;  	    ediff-split-window-function
;;  	    ediff-use-last-dir
Richard M. Stallman's avatar
Richard M. Stallman committed
500
;;  	    ediff-no-help-in-control-buffer
501
;;  	    ediff-toggle-read-only-function
Richard M. Stallman's avatar
Richard M. Stallman committed
502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525
;;
;; ediff-split-window-function controls the way you want the window be
;; split between file-A and file-B.  It defaults to vertical split, but you
;; can set it to 'split-window-horizontally, if you want.  Ediff lets you
;; toggle the way windows are split, so you can try different settings
;; interactively.  Note: if file-A and file-B are in different frames,
;; windows are not split, regardless of the value
;; ediff-split-window-function.  Instead, other windows on these frames are
;; deleted and Ediff starts displaying file-A and file-B using these two
;; frames, one file per frame.  You can then switch to one-frame mode
;; simply by hiding the file-A/B buffer that is displayed on a frame other
;; than the control-window frame.
;;
;; Note that if Ediff sees that the two buffers it compares are residing in
;; separate frames, it assumes that the user wants them to be so displayed
;; and stops splitting windows.  Instead, it will arrange each buffer to
;; occupy its own frame (possibly shared with Ediff's help window).
;;
;; The variable ediff-use-last-dir controls the way Ediff presents the
;; default directory when it prompts the user for files to compare.  If nil,
;; Ediff will use the default directory of the current buffer when it
;; prompts the user for file names.  Otherwise, it will use the
;; directories it had previously used for file-A and file-B. 
;;
526 527 528 529 530 531 532 533 534 535
;; The variable ediff-no-help-in-control-buffer, if set to t, makes C-h
;; behave like the DEL key, i.e., it will move you back to the previous
;; difference rather than invoking help.  This is useful when, in an xterm
;; window or on a dumb terminal, the Backspace key is bound to C-h and is
;; positioned more conveniently than the DEL key.
;;
;; The variable ediff-toggle-read-only-function can be used to change the
;; way Ediff toggles the read-only property in its buffers.
;; By default, Ediff uses toggle-read-only. For files under version
;; control, Ediff first tries to check the files out.
Richard M. Stallman's avatar
Richard M. Stallman committed
536 537 538 539 540 541 542 543 544 545


;;; Commands
;;  --------

;; All Ediff commands are displayed in a help window, unless you hit '?' to
;; shrink it to just one line.  You can redisplay the help window by hitting
;; '?' again.
;;
;; Many Ediff commands take numeric prefix arguments.  For instance, if you
Richard M. Stallman's avatar
Richard M. Stallman committed
546 547
;; hit a number, N, and then 'j' (ediff-jump-to-difference), Ediff will
;; take you to Nth difference.  Hitting a number, N, and then 'ab'
Richard M. Stallman's avatar
Richard M. Stallman committed
548
;; (ediff-diff-to-diff) will copy Nth difference from buffer A to buffer B.
Richard M. Stallman's avatar
Richard M. Stallman committed
549
;; Hitting 'ba' does copying in the other direction.
Richard M. Stallman's avatar
Richard M. Stallman committed
550
;; Likewise, a number, N, followed by 'ra' will restore the Nth difference
Richard M. Stallman's avatar
Richard M. Stallman committed
551 552 553 554 555 556 557 558
;; region in buffer A (if it was previously saved as a result of copying
;; from B to A). 
;;
;; Without the prefix argument, all commands operate on the current
;; difference region.
;;
;; The total number of differences and the current difference number are
;; always displayed in the mode line of the control window. 
559 560 561 562 563 564
;;
;; If, after making changes to buffers A and B, you decide to save them, it
;; is recommended to use `ediff-save-buffer', which is bound to `wa' and
;; `wb' (`wa will save buffer A and `wb' saves buffer B).
;;
;; Typing `wf' will also save the diff output in a file. 
Richard M. Stallman's avatar
Richard M. Stallman committed
565 566 567 568 569 570 571 572 573 574 575 576 577

;;; Display Modes
;;  -------------

;; Ediff can display files in one frame, stacked side-by-side or one on top
;; of another; or it can display the files in different frames.  When you
;; start Ediff, it assumes a 1-frame mode.  You can toggle the side-by-side
;; and one-on-top-of-another displays by simply hitting 's'.
;;
;; Ediff switches to the multi-frame mode when:
;;
;;  1. file-A and file-B are in different frames (you have to put them into
;;     different frames manually); or
578
;;  2. Ediff Control Panel is visible in one frame and one other file (A
Richard M. Stallman's avatar
Richard M. Stallman committed
579
;;     or B) is visible in another frame.  If, say, fileA is visible in a
580
;;     different frame than Ediff Control Panel, fileB doesn't have to be
Richard M. Stallman's avatar
Richard M. Stallman committed
581 582
;;     visible.  If it is, Ediff will continue displaying fileB in the frame
;;     where it was visible before.  If it isn't then Ediff will arrange for
583
;;     fileB to share a frame with Ediff Control Panel.
Richard M. Stallman's avatar
Richard M. Stallman committed
584 585 586 587
;;
;;  If all three buffers are in separate frames, Ediff will switch to a
;;  3-frame mode.  If Ediff buffers are currently visible only in two
;;  frames, Ediff will work in a 2-frame mode.  In this mode, one of the
588
;;  frames will be shared by Ediff Control Panel and file-A or file-B
Richard M. Stallman's avatar
Richard M. Stallman committed
589 590 591 592 593 594 595 596 597
;;  (whichever is appropriate).


;;; Bugs:
;;  ----

;;  1. The undo command doesn't restore deleted regions well. That is, if
;;  you delete all characters in a difference region and then invoke
;;  `undo', the reinserted text will most likely be reinserted outside of
Richard M. Stallman's avatar
Richard M. Stallman committed
598 599 600 601 602 603 604 605 606
;;  what Ediff thinks is the current difference region. (This problem
;;  doesn't seem to exist with Lucid Emacs.)
;;
;;  If at any point you feel that difference regions are no longer correct,
;;  you can hit '!' to recompute the differences.

;;  2. Emacs 19.xx, where xx < 23, has several bugs related to overlays and
;;  faces. Somethimes, these may cause highlighting of the refinements or
;;  of the unselected differences to disappear. Hitting `!' will bring them
607
;;  back.  In version 19.23 and later, these problems no longer occur.
Richard M. Stallman's avatar
Richard M. Stallman committed
608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623

;;  3. On a monochrome display, the repertoire of faces with which to
;;  highlight fine differences is limited. By default, Ediff is using
;;  underlining. However, if the region is already underlied by some other
;;  overlays, there is no simple way to temporarily remove that residual
;;  underlining. This problem occurs when a buffer is highlighted with
;;  hilit19.el or font-lock.el packages. If this residual highlighting gets
;;  in the way, you can do the following. Both font-lock.el and hilit19.el
;;  provide commands for unhighlighting buffers. You can either place these
;;  commands in `ediff-prepare-buffer-hooks' (which will unhighlight every
;;  buffer used by Ediff) or you can execute them interactively, at any time
;;  and on any buffer.

;;  4. In Lucid Emacs (statically linked with Motif libraries), emerge.el
;;  and hence ediff.el won't start, unless you set (setq scrollbar-width 0).
;;  This is a Motif-related bug, I was told.
Richard M. Stallman's avatar
Richard M. Stallman committed
624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780


;;; Change Log:
;;  ----------

;; Thu Feb  3, 1994 

;;     Added ediff-read-file-name, which is a stub that takes care of Lemacs
;;     versions of Emerge. (Thanks to Alastair Burt <burt@dfki.uni-kl.de>.)
;;
;;     Fixed a bug in ediff-setup-windows that caused control window to
;;     appear in a wrong place when split-window-keep-point is nil
;;     (Thanks to Kevin Broadey <KevinB@bartley.demon.co.uk>.)
;;
;;     Added mechanism for using faces instead of before/after flags.  This
;;     looks much better on an X display, especially on a color one.
;;     (Thanks to Boris Goldowsky <boris@cs.rochester.edu> for the code
;;     that led to ediff-highlight-diff.
;;     Also, thanks to Kevin Esler <esler@ch.hp.com> for suggestions
;;     regarding highlighting differences on X displays.)
;;
;;     Added functions to apply patches.
;;     (Thanks to Kevin Broadey <KevinB@bartley.demon.co.uk> for this
;;     suggestion.)

;; Fri Feb  4, 1994 

;;     Added mechanism for toggling vertical/horizontal window split.
;;     (Inspired by a suggestion from Allan Gottlieb
;;     <gottlieb@allan.ultra.nyu.edu> -- thanks.)
;;
;;     Added mechanism for toggling between highlighting using faces and
;;     highlighting using ASCII flags.
;;
;;     Fixed a problem with undo.  Now, Ediff has smartened up and doesn't
;;     keep undo info on ASCII flags inserted in buffer-A and buffer-B.
;;     So, if you edit the files while browsing through them, undo behaves
;;     as you would expect, i.e., faces/flags don't get in the way.

;; Sun Feb  6, 1994 

;;     Added horizontal scrolling.  Added ediff-position-region to ensure
;;     that difference regions in buffer-A and buffer-B are aligned with
;;     each other.  Disabled ediff-toggle-split when buffers are displayed
;;     in different frames.

;; Mon Feb  7, 1994

;;     Added toggle-window help (Suggested by Boris Goldowsky
;;     <boris@cs.rochester.edu>.)
;;     Added functions to copy differences from one buffer to another and to
;;     recover old differences.
;;     Added prefix arguments to ediff-next-difference and
;;     ediff-previous-difference.

;; Tue Feb  8, 1994

;;     Replaced text properties with overlays.  Fixed ediff-setup-windows.
;;     Added ediff-save-buffer to local-write-file-hooks to prevent user
;;     from saving corrupted states. (Thanks to <boris@cs.rochester.edu>
;;     for suggestion.)  Instead, Ediff now has a pair of functions for
;;     safe saving of buffers. 
;;     Changed ediff-read-file-name to be more intuitive on ediff-files.
;;     Added ediff-prepare-buffer-hooks. (Thanks to Kevin Esler
;;     <esler@ch.hp.com> for the idea.)

;; Wed Feb  9, 1994

;;     Cleanups in ediff-patch-file.  Protected ediff-copy-diff against
;;     a bug that Emacs has in kill-region.

;; Thu Feb 10, 1994

;;     Added support for Lemacs. (Thanks to Alastair Burt
;;     <burt@dfki.uni-kl.de> for coercing Ediff into working under Lemacs.)
;;     Added ediff-kill-buffer-carefully and other suggestions by Boris
;;     Goldowsky <boris@cs.rochester.edu>.
;;     Refined the protection against interference with highlighting caused
;;     by Hilit19.  Added the variable ediff-third-party-highlighting.
;;     Added mechanisn for unhighlighting regions highlighted with Hilit19
;;     before hightlighting them with Ediff's overlays. (And for
;;     rehighlighting them with Hilit19, when the current difference moves on.)

;; Sun Feb 13, 1994

;;     Added ediff-place-flags-in-buffer and ediff-remote-exit, which are
;;     modifications of Emerge's similar functions.  The difference is that
;;     in Ediff they make ediff-before-flag and ediff-after-flag into
;;     read-only regions, so the user can't change them by mistake.
;;
;;     Adopted a suggestion by Boris Goldowsky <boris@cs.rochester.edu>
;;     that led to a more elegant treatment of faces.
;;
;;     Added protection against interference with Font-Lock highlighting
;;     similar to that of Hilit19's protection.

;; Tue Feb 15, 1994

;;     Deleted spurious (auto-save-mode 1) in ediff-control-buffer, which
;;     was causing this buffer to be auto-saved for no good reason.
;;     Added read-only protection to ediff-before/after-flags in Lemacs.
;;     (Thanks to Alastair Burt <burt@dfki.uni-kl.de> for help in testing.)

;; Wed Feb 16, 1994

;;     Further fixes in the Lemacs part.  Changed highlighted region in
;;     ediff-highlight-diff so that an extra character will be highlighted
;;     only if a difference is empty (thereby allowing the user to see where an
;;     insertion or a deletion has taken place).
;;
;;     Simplified interaction with other highlighting packages by giving
;;     Ediff overlays the highest priority. (Taking a cue from
;;     ediff-highlight-diff-lemacs written by Alastair Burt
;;     <burt@dfki.uni-kl.de>.) Zapped ediff-third-party-highlighting
;;     variable and hooks that were previously used to
;;     unhighlight/rehighlight buffers when hilit19/font-lock are on.

;; Fri Feb 18, 1994

;;     Added a bit more sophistication to ediff-read-file-name.  Now,
;;     ediff-files remembers both, the file-A and the file-B directories.
;;     They are offered as defaults when ediff-use-last-dir is set to t.

;; Fri Feb 22, 1994

;;     Added ediff-before-change-guard to remove ASCII highlighting when
;;     the user attempts to change buffer-A/B.  This is needed because
;;     otherwise the undo info may become screwed up in those buffers.
;;     Hitting 'h' (ediff-toggle-hilit) on a dumb terminal will toggle
;;     between ASCII highlighting and no highlighting.

;; Fri Feb 24, 1994

;;     Fixed problems with multiple Ediff sessions running simultaneously.

;; Tue Mar 1, 1994

;;     Added vc-ediff, the Ediff interface to vc.el. (Thanks to Eric
;;     Freudenthal <freudent@jan.ultra.nyu.edu> for contributing this
;;     function.) 

;; Sun Mar 6, 1994

;;     Added rcs-ediff, an Ediff interface to RCS via rcs.el. (Thanks to
;;     Alastair Burt  <burt@dfki.uni-kl.de>.)
;;     Some minor improvements.

;; Tue March 15, 1994

;;     Fixed a buglet in defining ediff-current-diff-face-A/B.
;;     (Thanks to Job Ganzevoort  <Job.Ganzevoort@cwi.nl>.) 

;; Tue March 22, 1994

;;     Fixed a bug with ediffing narrowed buffers, reported by Kevin
;;     Broadey <KevinB@bartley.demon.co.uk>.
;;     Made Ediff to work with files that have incomplete last line.
Richard M. Stallman's avatar
Richard M. Stallman committed
781
;;     Made Ediff execute diff and patch using Bourne Shell, which
Richard M. Stallman's avatar
Richard M. Stallman committed
782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809
;;     should eliminate problems with $prompt that some people had.

;; Thu March 24, 1994

;;     Achieved quadratic speedup in the size of the file by replacing the
;;     slow goto-line by forward-line.  Ediff is now *much* faster than
;;     Emerge on large files.  Converted demarkation of difference regions
;;     from markers to overlays.  This will later allow us to highlight all
;;     diffs, not just the current one.

;; Wed March 30, 1994

;;     Under X, Ediff now highlights all differences in dim colors and the
;;     current difference in bright colors. Improved Lucid Emacs support.

;; Thu March 31, 1994

;;     Changed toggle hilit to cycle through 3 states: highlighting all
;;     diffs, highlighting only the current diff, and highlighting using
;;     ASCII flags.
;;     Added support for difference regions that are not full lines.

;; Fri April 1, 1994

;;     Fixed bugs related to writing buffers A and B.
;;     Added commands 'ga', 'gb' to jump directly to the closest diff in
;;     buffer A and B, respectively.

Richard M. Stallman's avatar
Richard M. Stallman committed
810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838
;; Fri April 11, 1994

;;     Added `ediff-recompute-diffs', a function that lets the user recompute
;;     difference regions after extensive editing done to buffers A and B
;;     (bound to `!').

;; Wed April 13, 1994

;;     Added the new feature: refining the current difference region.
;;     This would highlight the precise differences between the regions in
;;     buffer A and B. (A way to implement this was suggested by Boris
;;     Goldowsky <boris@cs.rochester.edu>.)
;;
;;     Fixed Ediff to be immune to several different versions of rcs.el
;;     that are currently in distribution.

;; Thu April 14, 1994

;;     Ediff now respects X resources for the faces it uses. It no longer
;;     barks when the colormap has no colors it is using; or when face
;;     fonts can't be italicized, etc.

;; Fri April 15, 1994

;;     Changed `ediff-setup-windows' to minimize the need to delete and
;;     create windows. Now jumps faster from diff to diff.

;; Sat April 16, 1994

839
;;     Added Ediff to the File menu on the menu bar (FSF's version).
Richard M. Stallman's avatar
Richard M. Stallman committed
840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867

;; Mon April 18, 1994

;;     Fixed to work with OS/2's PM-Emacs.

;; Thu April 21, 1994

;;     Lemacs' menus added (thanks to Alastair Burt for the help).

;; Wed April 28, 1994

;;     Fixed ediff-leave-window-config (thanks to Norbert Kiesel 
;;     <norbert@i3.informatik.rwth-aachen.de>), ediff-shell and
;;     ediff-protect-metachars (thanks to Richard Stanton
;;     <stanton@haas.berkeley.edu>). Made access to difference
;;     overlays structure-independent, making it less bug-prone.
;;     Patched ediff-read-file-name to work more intuitively with directory
;;     names (thanks to Kevin Broadey <KevinB@bartley.demon.co.uk>).

;; Mon May 2, 1994

;;     Added `ediff-frame-has-menubar' to guard against the possibility that
;;     the current frame has no menu bar.

;; Fri May 6, 1994

;;     Fixed buglet in vc-ediff (thanks to Ray Nickson <nickson@cs.uq.oz.au>).

868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916
;; Wed May 18, 1994

;;     Modified ediff-read-file-name to not put long file names in the
;;     default prompt area, as suggested by KevinB@bartley.demon.co.uk.
;;     Applied patch supplied by burt@dfki.uni-kl.de, fixing a problem with
;;     ediff-diff-to-diff in Lemacs.

;; Tue May 31, 1994

;;     Added ediff-forward-word-function (as suggested by Job Ganzevoort
;;     <Job.Ganzevoort@cwi.nl>). Modified ediff-default-quit-hook so it
;;     will clean things up in a more satisfactory way.

;; Thu Jun 2, 1994

;;     Added `ediff-toggle-regexp-match', which allows the user to step
;;     through only those difference regions that match some regexp; or,
;;     vice versa, to skip over regions that match a regexp. (This feature
;;     was suggested by Andy Scott <ascott@pcocd2.intel.com>.)
;;     Added ediff-eval-in-buffer, which is a modified emerge-eval-in-buffer.
;;     The function ediff-status-info, bound to `i', now replaces and extends
;;     ediff-file-names and ediff-line-numbers, which were bound to `f'
;;     and `i', respectively.

;; Wed Jun 8, 1994

;;     Made `ediff-frame-has-menubar' into a function; copied
;;     `emerge-defvar-local' and turned it into `ediff-defvar-local' 
;;     This is supposed to make the same ediff.elc file work for both Emacs
;;     and Lucid Emacs, at least, if compiled under Lucid Emacs. (Thanks
;;     to Eric Eide <eeide@asylum.cs.utah.edu>.)

;; Wed Jun 10, 1994

;;     Improved `ediff-read-file-name' and `ediff-buffers' so they are now
;;     providing more intuitive defaults. Modified `ediff-read-file-name'
;;     so it won't cause problems under OS/2.

;; Fri Jun 24, 1994

;;     Modified ediff-find-file, ediff-files-internal, and made
;;     emerge-verify-file-buffer into ediff-verify-file-buffer so that
;;     Ediff will work correctly with remote and compressed
;;     files. (Suggested by Sandy Rutherford <sandy@ibm550.sissa.it>.)

;; Fri Jun 28, 1994

;;     Fixed ediff-patch-files to work with remote and compressed files.

917 918 919 920 921 922 923 924 925 926 927 928 929 930
;; Wed July 20, 1994

;;     Changed menu bar items per RMS's suggestion. Changed odd/even faces
;;     in Lemacs to italic.  Changed ediff-*-face-* variables so that they
;;     will contain names of faces instead of the face internal
;;     representation.  (Copy-face works better with face names than with
;;     face internal representation.  With face internal representation, if
;;     a face vector mentions a font explicitly, copy-face may attempt to
;;     copy this font, which would cause an error if the font has a wrong
;;     size for one of the existing frames.)  Improved the way
;;     mode-line-buffer-identification is set in ediff-setup so that Ediff
;;     will accommodate the way buffers are identified in mode-line.el and
;;     uniquify.el.

931 932 933 934 935 936 937 938 939 940 941 942
;; Fri August 5, 1994

;;     Ediff can now automatically skip over regions that differ only in
;;     the white space and line breaks. This is controled with the variable
;;     `ediff-ignore-similar-regions' and can be toggled on/off by typing
;;     `##'.

;; Mon August 8, 1994

;;     If ediff-save-buffer is invoked with `wf', it'll save the diff
;;     output in a file.

943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967
;; Wed August 24, 1994

;;     Fixed ediff-toggle-read-only and ediff-patch-file so that they will
;;     check out version-controled files before modifying them. This will
;;     permit checking the modified versions back in. In earlier
;;     versions, such modifications could be lost, unless the user takes
;;     special care of preserving them.

;; Tue August 30, 1994

;;     Added ediff-submit-report.
;;     Introduced ediff-revision as a uniform way of calling vc.el and
;;     rcs.el. This is controled by ediff-version-control-package
;;     variable. Functions vc-ediff, rcs-ediff are replaced by their
;;     internal versions.
;;     Added ediff-find-file-name-handler function to smooth out the
;;     transition from Emacs 19.22/Lucid 19.9 to 19.23/19/10

;; Thus September 1, 1994

;;     Made ediff-overlay-put and ediff-move-overlay into bona fide
;;     functions (rather than fset symbols). These now check if overlay's
;;     buffer is alive. If not, overlay is deleted. This overcomes some of
;;     the problems with Lemacs.

Richard M. Stallman's avatar
Richard M. Stallman committed
968 969 970 971 972

;;; Acknowledgements:

;; Special thanks to Alastair Burt <burt@dfki.uni-kl.de>, Kevin Esler
;; <esler@ch.hp.com>, Kevin Broadey <KevinB@bartley.demon.co.uk>, 
973 974 975
;; Harald Boegeholz <hwb@machnix.mathematik.uni-stuttgart.de>,
;; Robert Estes <estes@ece.ucdavis.edu>, Eric Eide <eeide@asylum.cs.utah.edu>,
;; Eric Freudenthal  <freudent@jan.ultra.nyu.edu>, Job Ganzevoort 
Richard M. Stallman's avatar
Richard M. Stallman committed
976 977 978 979 980 981 982
;; <Job.Ganzevoort@cwi.nl>, Boris Goldowsky <boris@cs.rochester.edu>,
;; Allan Gottlieb <gottlieb@allan.ultra.nyu.edu>, Xiaoli Huang
;; <hxl@epic.com>, irvine@lks.csi.com, jaffe@chipmunk.cita.utoronto.ca,
;; David Karr, <dkarr@nmo.gtegsc.com>, Norbert Kiesel 
;; <norbert@i3.informatik.rwth-aachen.de>, Heinz Knutzen
;; <hk@informatik.uni-kiel.d400.de>, Martin Maechler
;; <maechler@stat.math.ethz.ch>, Richard Mlynarik <mly@adoc.xerox.com>,
983 984 985 986 987
;; Eyvind Ness <Eyvind.Ness@hrp.no>, Ray Nickson <nickson@cs.uq.oz.au>,
;; Sandy Rutherford <sandy@ibm550.sissa.it>,  Andy Scott
;; <ascott@pcocd2.intel.com>, Richard Stallman <rms@gnu.ai.mit.edu>,
;; Richard Stanton, <stanton@haas.berkeley.edu>, Peter Stout
;; <Peter_Stout@cs.cmu.edu> for contributing ideas, patches, and bug reports. 
Richard M. Stallman's avatar
Richard M. Stallman committed
988 989 990 991
;;
;; Thanks also to many others who felt obliged to drop a thanks note.


Richard M. Stallman's avatar
Richard M. Stallman committed
992 993 994

;;; Code:

Richard M. Stallman's avatar
Richard M. Stallman committed
995
(require 'emerge) ;; Ediff uses some functions defined in emerge.el
Richard M. Stallman's avatar
Richard M. Stallman committed
996 997 998 999 1000


;;; Macros
(defmacro ediff-if-lucid ()
  (` (string-match "Lucid" emacs-version)))
Richard M. Stallman's avatar
Richard M. Stallman committed
1001

Richard M. Stallman's avatar
Richard M. Stallman committed
1002 1003
(defmacro ediff-odd-p (arg)
  (` (eq (logand (, arg) 1) 1)))
Richard M. Stallman's avatar
Richard M. Stallman committed
1004

Richard M. Stallman's avatar
Richard M. Stallman committed
1005 1006 1007
(defmacro ediff-buffer-live-p (buf)
  (` (and (, buf) (get-buffer (, buf)) (buffer-name (get-buffer (, buf))))))

Richard M. Stallman's avatar
Richard M. Stallman committed
1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022
(defmacro ediff-get-buffer (arg)
  (` (cond ((eq (, arg) 'A) ediff-A-buffer)
	   ((eq (, arg) 'B) ediff-B-buffer)
	   )
  ))
	   
(defmacro ediff-char-to-buftype (arg)
  (` (cond ((eq (, arg) ?a) 'A)
	   ((eq (, arg) ?b) 'B)
	   )
  ))
  
(defmacro ediff-get-difference (n)
  (` (aref ediff-difference-vector (, n))))
  
1023 1024 1025 1026 1027 1028 1029
;; tell if it has been previously found that the region doesn't
;; contain diffs other than the white space and newlines
;; The argument, N, is the diff region number used by Ediff to index the
;; diff vector. It is 1 less than the number seen by the user.
(defmacro ediff-no-fine-diffs (n)
  (` (aref (ediff-get-difference n) 3)))
  
Richard M. Stallman's avatar
Richard M. Stallman committed
1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046
(defmacro ediff-get-diff-overlay-from-vector (vec buf-type)
  (` (aref (, vec)
	   (cond ((eq (, buf-type) 'A) 0)
		 ((eq (, buf-type) 'B) 1)
		 )
	   )))
  
(defmacro ediff-get-diff-overlay (n buf-type)  
  (` (ediff-get-diff-overlay-from-vector
      (ediff-get-difference (, n))
      (, buf-type))))

(defmacro ediff-get-fine-diff-vector-from-vec (current-diff-vec)
  (` (aref (, current-diff-vec) 2)))
      
(defmacro ediff-set-fine-diff-vector (n fine-vec)
  (` (aset (ediff-get-difference (, n)) 2 (, fine-vec))))
1047 1048 1049 1050 1051 1052 1053

;; if flag is t, puts a mark on diff region saying that 
;; the differences are in white space only. If flag is nil,
;; the region is marked as essential (i.e., differences are
;; not just in the white space and newlines.)
(defmacro ediff-mark-diff-as-space-only (n flag)
  (` (aset (ediff-get-difference (, n)) 3 (, flag))))
Richard M. Stallman's avatar
Richard M. Stallman committed
1054 1055 1056 1057
  
(defmacro ediff-get-fine-diff-vector (n)
  (` (ediff-get-fine-diff-vector-from-vec (ediff-get-difference (, n)))))
  
1058
  
1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088
(defmacro ediff-defvar-local (var value doc) 
  "Defines SYMBOL as an advertised local variable.  
Performs a defvar, then executes `make-variable-buffer-local' on
the variable.  Also sets the `preserved' (Emacs) or `permanent-local' (Lucid)
property, so that `kill-all-local-variables' (called by major-mode setting
commands) won't destroy Ediff control variables.

This is a merge of `emerge-defvar-local' for Emacs and Lucid Emacs.  It is
needed to make the same ediff.elc work under both Emacsen."
  (` (progn
       (defvar (, var) (, value) (, doc))
       (make-variable-buffer-local '(, var))
       (put '(, var)
	    (if (ediff-if-lucid) 'permanent-local 'preserved)
	    t))))
    
(defmacro ediff-eval-in-buffer (buffer &rest forms)
  "Macro to switch to BUFFER, evaluate FORMS, returns to original buffer.
Differs from `save-excursion' in that it doesn't save the point and mark.
This is essentially `emerge-eval-in-buffer' with the test for live buffers."
  (` (let ((StartBuffer (current-buffer)))
       (if (ediff-buffer-live-p (, buffer))
	   (unwind-protect
	       (progn
		 (set-buffer (, buffer))
		 (,@ forms))
	     (set-buffer StartBuffer))
	 (beep 1)
	 (message "You seem to have killed an essential Ediff buffer---quit!"))
       )))
Richard M. Stallman's avatar
Richard M. Stallman committed
1089 1090 1091


;;; Functions
Richard M. Stallman's avatar
Richard M. Stallman committed
1092 1093 1094 1095

(defun ediff-mode ()
  "Ediff mode is used by the Ediff file-difference package.
It is entered only through one of the following commands:
Richard M. Stallman's avatar
Richard M. Stallman committed
1096 1097 1098 1099 1100 1101
	`ediff'
	`ediff-files'
	`ediff-buffers'
	`epatch'
	`ediff-patch-file'
	`ediff-patch-buffer'
Richard M. Stallman's avatar
Richard M. Stallman committed
1102
	`epatch-buffer'
1103
	`ediff-revision'
Richard M. Stallman's avatar
Richard M. Stallman committed
1104 1105 1106 1107 1108 1109 1110 1111

Commands:
\\{ediff-mode-map}"
  (interactive)
  (kill-all-local-variables)
  (setq major-mode 'ediff-mode)
  (setq mode-name "Ediff"))

1112 1113 1114 1115 1116 1117 1118 1119
(defun ediff-version ()
  "Return string describing the version of Ediff.
When called interactively, displays the version."
  (interactive)
  (if (interactive-p)
      (message (ediff-version))
    (format "Ediff %s of %s" ediff-version ediff-date)))

Richard M. Stallman's avatar
Richard M. Stallman committed
1120 1121 1122 1123

;; Hook variables

(defvar ediff-before-setup-windows-hooks nil
Richard M. Stallman's avatar
Richard M. Stallman committed
1124 1125 1126
  "*Hooks to run before Ediff sets its own window config. 
This can be used to save the previous window config, which can be restored
on ediff-quit or ediff-suspend.") 
Richard M. Stallman's avatar
Richard M. Stallman committed
1127 1128 1129 1130 1131 1132 1133 1134 1135
(defvar ediff-startup-hooks nil
  "*Hooks to run in the control buffer after Ediff has been set up.")
(defvar ediff-select-hooks nil
  "*Hooks to run after a difference has been selected.")
(defvar ediff-unselect-hooks nil
  "*Hooks to run after a difference has been unselected.")
(defvar ediff-prepare-buffer-hooks  nil
  "*Hooks called after buffers A and B are set up.")
(defvar ediff-load-hooks nil
Richard M. Stallman's avatar
Richard M. Stallman committed
1136
  "*Hook run after Ediff is loaded.  Can be used to change defaults.")
Richard M. Stallman's avatar
Richard M. Stallman committed
1137

Richard M. Stallman's avatar
Richard M. Stallman committed
1138
(defvar ediff-suspend-hooks (list 'ediff-default-suspend-hook)
Richard M. Stallman's avatar
Richard M. Stallman committed
1139
  "*Hooks to run in the Ediff control buffer when Ediff is suspended.")
Richard M. Stallman's avatar
Richard M. Stallman committed
1140
(defvar ediff-quit-hooks (list 'ediff-default-quit-hook)
Richard M. Stallman's avatar
Richard M. Stallman committed
1141
  "*Hooks to run in the Ediff control buffer after finishing Ediff.") 
Richard M. Stallman's avatar
Richard M. Stallman committed
1142 1143 1144 1145 1146 1147 1148

(make-variable-buffer-local 'local-write-file-hooks)
(make-variable-buffer-local 'before-change-function)

;; Help messages

(defconst ediff-help-message-long
1149 1150 1151 1152 1153 1154 1155 1156 1157 1158
  "    Moving around      |     Toggling features     |       Miscellaneous
=======================|===========================|===========================
p,DEL -previous diff   |     s -vert/horiz split   | ab/ba -copy diff A->B/B->A
n,SPC -next diff       |     h -hiliting           | ra/rb -restore diff in A/B
    j -jump to diff    |     @ -auto-refining      |     * -refine diff
ga/gb -to point in A/B |---------------------------|     ! -recompute diffs
    c -recenter        |    ## -skip whitespace    |---------------------------
  v/V -scroll up/down  | #f/#h -focus/hide regions | wa/wb -save buf A/B
  </> -scroll lft/rght |   A/B -read-only buf A/B  |    wf -save diff output
=======================|===========================|===========================
1159
		       |   bug -submit bug report  |
1160 1161
    i -status info     |     ? -toggle help window |   z/q -suspend/quit Ediff"
  )
Richard M. Stallman's avatar
Richard M. Stallman committed
1162 1163
			  
(defconst ediff-help-message-short
1164
  "                             ? - toggle help window")
Richard M. Stallman's avatar
Richard M. Stallman committed
1165 1166

(defvar ediff-help-message ediff-help-message-long
Richard M. Stallman's avatar
Richard M. Stallman committed
1167
  "*The actual help message.")
Richard M. Stallman's avatar
Richard M. Stallman committed
1168
 
Richard M. Stallman's avatar
Richard M. Stallman committed
1169
;; diff stuff.
Richard M. Stallman's avatar
Richard M. Stallman committed
1170
(defvar ediff-diff-program "diff"
Richard M. Stallman's avatar
Richard M. Stallman committed
1171
  "*Name of the program that compares two files.")
Richard M. Stallman's avatar
Richard M. Stallman committed
1172
(defvar ediff-diff-options ""  
1173 1174 1175
  "*Options to pass to `ediff-diff-program'. 
If diff\(1\) is used as `ediff-diff-program', then the most useful options are
`-w', to ignore space, and `-i', to ignore case of letters.")
Richard M. Stallman's avatar
Richard M. Stallman committed
1176
  
1177 1178 1179 1180
;; Fine differences 
(defvar ediff-forward-word-function 'ediff-forward-word
  "*Function to call to move to the next word.
Used for splitting difference regions into individual words.")
Richard M. Stallman's avatar
Richard M. Stallman committed
1181 1182 1183 1184 1185 1186 1187 1188

(defvar ediff-fine-diff-program "diff"
  "*Name of the program that compares the current diff regions for fine differences.
  
This program should produce output in the format of diff. One could
possibly use `spiff' here if appropriate options are set.")

(defvar ediff-fine-diff-options ""  
1189 1190 1191
  "*Options to pass to `ediff-fine-diff-program'.
If diff\(1\) is used as `ediff-diff-program', then the most useful options are
`-w', to ignore space, and `-i', to ignore case of letters.")
Richard M. Stallman's avatar
Richard M. Stallman committed
1192
  
1193
(defvar ediff-whitespace " \n\t\C-j"
Richard M. Stallman's avatar
Richard M. Stallman committed
1194 1195 1196
  "*White space. Used to split strings into words.")

(defvar ediff-word-1 "a-zA-Z---_`'.?!:"
1197
  "*Characters matching this regexp constitute words of type 1.
Richard M. Stallman's avatar
Richard M. Stallman committed
1198 1199 1200 1201 1202 1203
  
Ediff is using a very simple schema for splitting text into words, which is
used to determine fine differences between regions. There are two types of
words. One consists entirely out of characters in `ediff-word-1'  and
another out of characters matching `ediff-word-1'.")

1204
(defvar ediff-word-2 "^a-zA-Z---_`'.?!: \t\n\C-j"
Richard M. Stallman's avatar
Richard M. Stallman committed
1205 1206
  "*Characters matching this regexp constitute words of type 2.
See `ediff-word-1' for more details.")  
1207 1208 1209

;; Selective browsing

1210 1211 1212 1213 1214 1215
(ediff-defvar-local ediff-skip-diff-region-function 'ediff-show-all-diffs
  "Function that determines the next/previous diff region to show.
Should return t for regions to be ignored and nil otherwise.
This function gets a region number as an argument. The region number
is the one used internally by Ediff. It is 1 less than the number seen
by the user.")
1216

1217
(ediff-defvar-local ediff-regexp-focus-A ""
1218
  "Regexp that determines buf A regions to focus on when skipping to diff.")
1219
(ediff-defvar-local ediff-regexp-focus-B ""
1220 1221
  "Regexp that determines buf B regions to focus on when skipping to diff.")
  
1222
(ediff-defvar-local ediff-regexp-hide-A ""
1223
  "Regexp that determines buf A regions to ignore when skipping to diff.")
1224
(ediff-defvar-local ediff-regexp-hide-B ""
1225
  "Regexp that determines buf B regions to ignore when skipping to diff.")  
Richard M. Stallman's avatar
Richard M. Stallman committed
1226
  
Richard M. Stallman's avatar
Richard M. Stallman committed
1227 1228 1229 1230

;; Support for patches 

(defvar ediff-patch-program "patch"
Richard M. Stallman's avatar
Richard M. Stallman committed
1231
  "*Name of the program that applies patches.")
Richard M. Stallman's avatar
Richard M. Stallman committed
1232
(defvar ediff-patch-options ""
Richard M. Stallman's avatar
Richard M. Stallman committed
1233
  "*Options to pass to ediff-patch-program.")
Richard M. Stallman's avatar
Richard M. Stallman committed
1234
  
Richard M. Stallman's avatar
Richard M. Stallman committed
1235 1236 1237 1238 1239 1240 1241 1242
(defvar ediff-shell (cond ((eq system-type 'emx) "cmd") ;; OS/2
			  (t  "sh")) ;; unix
  "*The shell used to run diff and patch.  If user's .profile or
.cshrc files are set up correctly, any shell will do.  However, some people
set $prompt or other things incorrectly, which leads to undesirable output
messages.  These may cause Ediff to fail.  In such a case, set ediff-shell
to a shell that you are not using or, better, fix your shell's startup file.")
  
Richard M. Stallman's avatar
Richard M. Stallman committed
1243 1244
(defvar ediff-diff-ok-lines-regexp  
  "^\\([0-9,]+[acd][0-9,]+$\\|[<>] \\|---\\|Warning:\\)"
1245
  "Regexp that matches normal output lines from `ediff-diff-program'.
Richard M. Stallman's avatar
Richard M. Stallman committed
1246 1247 1248 1249
This is mostly lifted from Emerge, except that Ediff also considers the
'Missing newline' message to be 'normal output.'
Lines that do not match are assumed to be error messages.")

Richard M. Stallman's avatar
Richard M. Stallman committed
1250 1251
(defvar ediff-fine-diff-ok-lines-regexp  
  "^\\([0-9,]+[acd][0-9,]+$\\|[<>] \\|---\\|Warning:\\)"
1252
  "Regexp that matches normal output lines from `ediff-fine-diff-program'.
Richard M. Stallman's avatar
Richard M. Stallman committed
1253 1254 1255 1256
This is mostly lifted from Emerge, except that Ediff also considers the
'Missing newline' message to be 'normal output.'
Lines that do not match are assumed to be error messages.")

Richard M. Stallman's avatar
Richard M. Stallman committed
1257 1258
(defvar ediff-match-diff-line (let ((x "\\([0-9]+\\)\\(\\|,\\([0-9]+\\)\\)"))
				(concat "^" x "\\([acd]\\)" x "$"))
1259
  "Pattern to match lines produced by diff that describe differences.")
Richard M. Stallman's avatar
Richard M. Stallman committed
1260 1261 1262 1263
  
(defvar ediff-patch-buf nil
  "The buffer of the patch file.")
(defvar ediff-patch-diagnostics nil
Richard M. Stallman's avatar
Richard M. Stallman committed
1264
  "The buffer where patch would display its diagnostics.")
Richard M. Stallman's avatar
Richard M. Stallman committed
1265 1266 1267
  


1268
;; Copying difference regions between buffers.    
1269
(ediff-defvar-local ediff-killed-diffs-alist nil
Richard M. Stallman's avatar
Richard M. Stallman committed
1270
  "A list of killed diffs. 
Richard M. Stallman's avatar
Richard M. Stallman committed
1271
A diff is saved here if it is replaced by a diff
Richard M. Stallman's avatar
Richard M. Stallman committed
1272
from another buffer.  This alist has the form:
Richard M. Stallman's avatar
Richard M. Stallman committed
1273
\((num (A . diff) (B . diff)) ...),
Richard M. Stallman's avatar
Richard M. Stallman committed
1274
where A or B parts may be missing.")
Richard M. Stallman's avatar
Richard M. Stallman committed
1275 1276 1277 1278 1279 1280


;; Highlighting
(defvar ediff-before-flag-bol
  ;"vvvvvvvvvvvvvvvv---- ediff ----vvvvvvvvvvvvvvv\n"
  ">>--->>>\n"
Richard M. Stallman's avatar
Richard M. Stallman committed
1281 1282
  "*Flag placed above the highlighted block of differences. 
Must end with newline.  Must be set before Ediff is loaded.")
Richard M. Stallman's avatar
Richard M. Stallman committed
1283 1284 1285
(defvar ediff-after-flag-bol
  ;"^^^^^^^^^^^^^^^^---- ediff ----^^^^^^^^^^^^^^^\n"
  "<<<---<<\n"
Richard M. Stallman's avatar
Richard M. Stallman committed
1286
  "*Flag placed below the highlighted block of differences.
Richard M. Stallman's avatar
Richard M. Stallman committed
1287
Must end with newline.  Must be set before Ediff is loaded.")
Richard M. Stallman's avatar
Richard M. Stallman committed
1288 1289

(defvar ediff-before-flag-mol ">>--->>>"
Richard M. Stallman's avatar
Richard M. Stallman committed
1290
  "*Like ediff-before-flag, used when a difference starts in mid-line.")
Richard M. Stallman's avatar
Richard M. Stallman committed
1291
(defvar ediff-after-flag-mol "<<<---<<"
Richard M. Stallman's avatar
Richard M. Stallman committed
1292
  "*Like ediff-after-flag, used when a difference starts in mid-line.")
Richard M. Stallman's avatar
Richard M. Stallman committed
1293

1294
(ediff-defvar-local ediff-before-flag-A nil
Richard M. Stallman's avatar
Richard M. Stallman committed
1295 1296 1297 1298
  "This is the actual ASCII before-flag in effect in buffer A.
It is either `ediff-before-flag-mol' or `ediff-before-flag-bol' depending
on whether the selected difference region starts in the middle of a line 
or at the beginning of a line.")
1299
(ediff-defvar-local ediff-after-flag-A nil
Richard M. Stallman's avatar
Richard M. Stallman committed
1300 1301 1302 1303
  "This is the actual ASCII after-flag in effect in buffer A.
It is either `ediff-before-flag-mol' or `ediff-before-flag-bol' depending
on whether the selected difference region starts in the middle of a line 
or at the beginning of a line.")
1304
(ediff-defvar-local ediff-before-flag-B nil
Richard M. Stallman's avatar
Richard M. Stallman committed
1305 1306 1307 1308
  "This is the actual ASCII before-flag in effect in buffer B.
It is either `ediff-before-flag-mol' or `ediff-before-flag-bol' depending
on whether the selected difference region starts in the middle of a line 
or at the beginning of a line.")
1309
(ediff-defvar-local ediff-after-flag-B nil
Richard M. Stallman's avatar
Richard M. Stallman committed
1310 1311 1312 1313 1314 1315
  "This is the actual ASCII after-flag in effect in buffer B.
It is either `ediff-before-flag-mol' or `ediff-before-flag-bol' depending
on whether the selected difference region starts in the middle of a line 
or at the beginning of a line.")

  
1316
(ediff-defvar-local ediff-want-faces t
Richard M. Stallman's avatar
Richard M. Stallman committed
1317 1318
  "If t, differences are highlighted using faces on a window system.
If nil, they are highlighted using ASCII flags, ediff-before-flag
Richard M. Stallman's avatar
Richard M. Stallman committed
1319 1320 1321
and ediff-after-flag.  On a non-window system, differences are always
highlighted using ASCII flags.

Richard M. Stallman's avatar
Richard M. Stallman committed
1322 1323 1324
This variable can be set either in .emacs or toggled interactively, using
ediff-toggle-hilit.") 

1325
(ediff-defvar-local ediff-want-default-menus t
Richard M. Stallman's avatar
Richard M. Stallman committed
1326 1327 1328 1329 1330
  "If t, Ediff will set up menus in the menu bar.
This variable must be set before Ediff is loaded. If you don't like the
look of the default menus, set this variable to nil and make your own
menus.")  

1331
(ediff-defvar-local ediff-auto-refine (if window-system 'on 'nix)
Richard M. Stallman's avatar
Richard M. Stallman committed
1332 1333 1334
  "If `'on', Ediff auto-highlights fine diffs for the current diff region.
If `off', auto-highlighting is not used. If `'nix', no fine diffs are shown
at all, unless the user force-refines the region by hitting `*'.
Richard M. Stallman's avatar
Richard M. Stallman committed
1335

Richard M. Stallman's avatar
Richard M. Stallman committed
1336 1337 1338
This variable can be set either in .emacs or toggled interactively, using
ediff-toggle-hilit.") 

1339 1340 1341
(ediff-defvar-local ediff-ignore-similar-regions nil
  "*If t, skip over difference regions that differ only in the white space and line breaks.")

1342
(ediff-defvar-local ediff-auto-refine-limit 700
Richard M. Stallman's avatar
Richard M. Stallman committed
1343 1344
  "Auto-refine only those regions that are smaller than this number of bytes.")

1345
(ediff-defvar-local ediff-highlight-all-diffs t
Richard M. Stallman's avatar
Richard M. Stallman committed
1346 1347 1348
  "If nil, only the selected differences are highlighted.
This variable can be set either in .emacs or toggled interactively, using
ediff-toggle-hilit.") 
Richard M. Stallman's avatar
Richard M. Stallman committed
1349

1350 1351
(ediff-defvar-local ediff-highlighting-style nil
  "A var local to each control panel buffer.
Richard M. Stallman's avatar
Richard M. Stallman committed
1352 1353 1354
Indicates highlighting style in effect for this buffer: `face', `ascii',
nil -- temporarily unhighlighted, `off' -- turned off \(on a dumb
terminal only\).")
Richard M. Stallman's avatar
Richard M. Stallman committed
1355 1356 1357 1358 1359 1360 1361

  

;; Variables that control each Ediff session.  They are local to the
;; control buffer. 

;; Mode variables
1362
(ediff-defvar-local ediff-A-buffer nil
Richard M. Stallman's avatar
Richard M. Stallman committed
1363
  "The buffer in which the A variant is stored.")
1364
(ediff-defvar-local ediff-B-buffer nil
Richard M. Stallman's avatar
Richard M. Stallman committed
1365
  "The buffer in which the B variant is stored.")
1366
(ediff-defvar-local ediff-control-buffer nil
Richard M. Stallman's avatar
Richard M. Stallman committed
1367 1368
  "The control buffer of ediff. ")

1369
;(ediff-defvar-local ediff-control-buffer-suffix nil
Richard M. Stallman's avatar
Richard M. Stallman committed
1370
;  "The suffix of the control buffer name. ")
Richard M. Stallman's avatar
Richard M. Stallman committed
1371
  
1372
(ediff-defvar-local ediff-control-window nil
Richard M. Stallman's avatar
Richard M. Stallman committed
1373
  "The control window.")
1374
(ediff-defvar-local ediff-window-config-saved ""
Richard M. Stallman's avatar
Richard M. Stallman committed
1375 1376
  "Ediff's window configuration.
Used to minimize the need to rearrange windows.")
Richard M. Stallman's avatar
Richard M. Stallman committed
1377 1378


1379
(ediff-defvar-local ediff-A-buffer-values nil
Richard M. Stallman's avatar
Richard M. Stallman committed
1380
  "Keeps working values of ediff-saved-variables for ediff-A-buffer.")
1381
(ediff-defvar-local ediff-B-buffer-values nil
Richard M. Stallman's avatar
Richard M. Stallman committed
1382 1383
  "Keeps working values of ediff-saved-variables for ediff-B-buffer.")

1384
(ediff-defvar-local ediff-A-buffer-values-setup nil
Richard M. Stallman's avatar
Richard M. Stallman committed
1385
  "Remembers ediff-saved-variables for ediff-A-buffer as they were at setup.")
1386
(ediff-defvar-local ediff-B-buffer-values-setup nil
Richard M. Stallman's avatar
Richard M. Stallman committed
1387 1388
  "Remembers ediff-saved-variables for ediff-B-buffer as they were at setup.")