7.13 Notes on Heavy-duty Customization

Some users need to customize Ediff in rather sophisticated ways, which requires different defaults for different kinds of files (e.g., SGML, etc.). Ediff supports this kind of customization in several ways. First, most customization variables are buffer-local. Those that aren’t are usually accessible from within Ediff Control Panel, so one can make them local to the panel by calling make-local-variable from within ediff-startup-hook.

Second, the function ediff-setup accepts an optional sixth argument which has the form ((var-name-1 . val-1) (var-name-2 . val-2) …). The function ediff-setup sets the variables in the list to the respective values, locally in the Ediff control buffer. This is an easy way to throw in custom variables (which usually should be buffer-local) that can then be tested in various hooks.

Make sure the variable ediff-job-name and ediff-word-mode are set properly in this case, as some things in Ediff depend on this.

Finally, if you want custom-tailored help messages, you can set the variables ediff-brief-help-message-function and ediff-long-help-message-function to functions that return help strings.

When customizing Ediff, some other variables are useful, although they are not user-definable. They are local to the Ediff control buffer, so this buffer must be current when you access these variables. The control buffer is accessible via the variable ediff-control-buffer, which is also local to that buffer. It is usually used for checking if the current buffer is also the control buffer.

Other variables of interest are:


The first of the data buffers being compared.


The second of the data buffers being compared.


In three-way comparisons, this is the third buffer being compared. In merging, this is the merge buffer. In two-way comparison, this variable is nil.


The window displaying buffer A. If buffer A is not visible, this variable is nil or it may be a dead window.


The window displaying buffer B.


The window displaying buffer C, if any.


A dedicated frame displaying the control buffer, if it exists. It is non-nil only if Ediff uses the multiframe display, i.e., when the control buffer is in its own frame.