Go to the first, previous, next, last section, table of contents.

# Major Entry Points

Ediff can be invoked interactively using the following functions, which can be run either from the minibuffer or from the menu bar. In the menu bar, all Ediff's entry points belong to three submenus of the Tools menu: Compare, Merge, and Apply Patch.

`ediff-files`
`ediff`
  Compare two files.
`ediff-buffers`
  Compare two buffers.
`ediff-files3`
`ediff3`
  Compare three files.
`ediff-buffers3`
  Compare three buffers.
`edirs`
`ediff-directories`
  Compare files common to two directories.
`edirs3`
`ediff-directories3`
  Compare files common to three directories.
`edir-revisions`
`ediff-directory-revisions`
  Compare versions of files in a given directory. Ediff selects only the files that are under version control.
`edir-merge-revisions`
`ediff-merge-directory-revisions`
  Merge versions of files in a given directory. Ediff selects only the files that are under version control.
`edir-merge-revisions-with-ancestor`
`ediff-merge-directory-revisions-with-ancestor`
  Merge versions of files in a given directory using other versions as ancestors. Ediff selects only the files that are under version control.
`ediff-windows-wordwise`
  Compare windows word-by-word.
`ediff-windows-linewise`
  Compare windows line-by-line.
`ediff-regions-wordwise`
  Compare regions word-by-word.
`ediff-regions-linewise`
  Compare regions line-by-line.
`ediff-revision`
  Compare versions of the current buffer, if the buffer is visiting a file under version control.
`ediff-patch-file`
`epatch`
  Patch a file, then compare.
`ediff-patch-buffer`
`epatch-buffer`
  Patch auffer, then compare.
`ediff-merge-files`
`ediff-merge`
  Merge two files.
`ediff-merge-files-with-ancestor`
`ediff-merge-with-ancestor`
  Like `ediff-merge`, but with a third ancestor file.
`ediff-merge-buffers`
  Merge two buffers.
`ediff-merge-buffers-with-ancestor`
  Same but with ancestor.
`edirs-merge`
`ediff-merge-directories`
  Merge files common to two directories.
`edirs-merge-with-ancestor`
`ediff-merge-directories-with-ancestor`
  Same but using files in a third directory as ancestors.
`ediff-merge-revisions`
  Merge two versions of the file visited by the current buffer.
`ediff-merge-revisions-with-ancestor`
  Same but with ancestor.

If you want Ediff to be loaded from the very beginning of your Emacs session, you should put this line in your ``~/.emacs'` file:

    (require 'ediff)

Otherwise, Ediff will be loaded automatically when you use one of the above functions, either directly or through the menus.

When the above functions are invoked, they prompt the user for the information they need--typically the files or buffers to compare or patch. Ediff tries to be smart about these prompts. For instance, in comparing/merging files, it will offer the visible buffers as defaults. In prompting for files, if the user enters a directory, the previously input file name will be appended to that directory. In addition, if the variable `ediff-use-last-dir` is not `nil`, Ediff will offer previously entered directories as defaults (which will be maintained separately for each type of file, A, B, or C).

All the above functions use the POSIX `diff` program to find differences between two files. They process the `diff` output and display it in a convenient form. At present, Ediff understands only the plain output from diff. Options such as ``-c'` are not supported, nor is the format produced by incompatible file comparison programs such as the VMS version of `diff`.

The functions `ediff-files`, `ediff-buffers`, `ediff-files3`, `ediff-buffers3` first display the coarse, line-based difference regions, as reported by the ``diff'` program. Since diff may report fairly large chunks of text as being different, even though the difference may be localized to just a few words or even to the white space or line breaks, Ediff further refines the regions to indicate which exact words differ. If the only difference is in the white space and line breaks, Ediff says so.

On a color display, fine differences are highlighted with color; on a monochrome display, they are underlined. See section Highlighting Difference Regions, for information on how to customize this.

The functions `ediff-windows-wordwise`, `ediff-windows-linewise`, `ediff-regions-wordwise` and `ediff-regions-linewise` do comparison on parts of existing Emacs buffers. Since `ediff-windows-wordwise` and `ediff-regions-wordwise` are intended for relatively small segments of buffers, comparison is done on the basis of words rather than lines. No refinement is necessary in this case. These commands are recommended only for relatively small regions (perhaps, up to 100 lines), because these functions have a relatively slow startup.

To compare large regions, use `ediff-regions-linewise`. This command displays differences much like `ediff-files` and `ediff-buffers`.

The functions `ediff-patch-file` and `ediff-patch-buffer` apply a patch to a file or a buffer and then run Ediff on these buffers, displaying the difference regions.

The entry points `ediff-directories`, `ediff-merge-directories`, etc., provide a convenient interface for comparing and merging files in different directories. The user is presented with Dired-like interface from which one can run a group of related Ediff sessions.

For files under version control, `ediff-revisions` lets you compare the file visited by the current buffer to one of its checked-in versions. You can also compare two checked-in versions of the visited file. Moreover, the functions `ediff-directory-revisions`, `ediff-merge-directory-revisions`, etc., let you run a group of related Ediff sessions by taking a directory and comparing (or merging) versions of files in that directory.

Go to the first, previous, next, last section, table of contents.