7.8 Patch and Diff Programs

This section describes variables that specify the programs to be used for applying patches and for computing the main difference regions (not the fine difference regions):

ediff-diff-program
ediff-diff3-program

These variables specify the programs to use to produce differences and do patching.

ediff-diff-options
ediff-diff3-options

These variables specify the options to pass to the above utilities.

In ediff-diff-options, it may be useful to specify options such as ‘-w’ that ignore certain kinds of changes. However, Ediff does not let you use the option ‘-c’, as it doesn’t recognize this format yet. (If you alter this variable, it should be done via the Customize interface instead of using setq directly.)

ediff-coding-system-for-read

This variable specifies the coding system to use when reading the output that the programs diff3 and diff send to Emacs. The default is raw-text, and this should work fine in Unix and in most cases under Windows NT/95/98/2000. There are diff programs for which the default option doesn’t work under Windows. In such cases, raw-text-dos might work. If not, you will have to experiment with other coding systems or use GNU diff.

ediff-patch-program

The program to use to apply patches. Since there are certain incompatibilities between the different versions of the patch program, the best way to stay out of trouble is to use a GNU-compatible version. Otherwise, you may have to tune the values of the variables ediff-patch-options, ediff-backup-specs, and ediff-backup-extension as described below.

ediff-patch-options

Options to pass to ediff-patch-program.

Note: the -b and -z options should be specified in ediff-backup-specs, not in ediff-patch-options.

It is recommended to pass the -f option to the patch program, so it won’t ask questions. However, some implementations don’t accept this option, in which case the default value of this variable should be changed.

ediff-backup-extension

Backup extension used by the patch program. Must be specified, even if ediff-backup-specs is given.

ediff-backup-specs

Backup directives to pass to the patch program. Ediff requires that the old version of the file (before applying the patch) is saved in a file named the-patch-file.extension. Usually extension is .orig, but this can be changed by the user, and may also be system-dependent. Therefore, Ediff needs to know the backup extension used by the patch program.

Some versions of the patch program let the user specify -b extension to specify a backup file name extension. Other versions only permit -b, which (usually) assumes the extension .orig. Yet others force you to use -zextension.

Both ediff-backup-extension and ediff-backup-specs must be properly set. If your patch program takes the option -b, but not -b extension, the variable ediff-backup-extension must still be set so Ediff will know which extension to use.

ediff-custom-diff-program
ediff-custom-diff-options

Because Ediff limits the options you may want to pass to the diff program, it partially makes up for this drawback by letting you save the output from diff in your preferred format, which is specified via the above two variables.

The output generated by ediff-custom-diff-program (which doesn’t even have to be a standard-style diff!) is not used by Ediff. It is provided exclusively so that you can refer to it later, send it over email, etc. For instance, after reviewing the differences, you may want to send context differences to a colleague. Since Ediff ignores the ‘-c’ option in ediff-diff-program, you would have to run diff -c separately just to produce the list of differences. Fortunately, ediff-custom-diff-program and ediff-custom-diff-options eliminate this nuisance by keeping a copy of a difference list in the desired format in a buffer that can be displayed via the command D.

ediff-patch-default-directory

Specifies the default directory to look for patches.