The bulk of customization can be done via the following hooks:
This hook can be used to change defaults after Ediff is loaded.
Hook that is run just before Ediff rearranges windows to its liking. Can be used to save windows configuration.
This hook can be used to alter bindings in Ediff’s keymap,
ediff-mode-map. These hooks are
run right after the default bindings are set but before
ediff-load-hook. The regular user needs not be concerned with this
hook—it is provided for implementers of other Emacs packages built on top
These two hooks are called before and after Ediff sets up its window configuration. These hooks are run each time Ediff rearranges windows to its liking. This happens whenever it detects that the user changed the windows setup.
These two hooks are run when you suspend or quit Ediff. They can be used to set desired window configurations, delete files Ediff didn’t want to clean up after exiting, etc.
ediff-quit-hook holds one hook function,
ediff-cleanup-mess, which cleans after Ediff, as appropriate in
most cases. You probably won’t want to change it, but you might
want to add other hook functions.
Keep in mind that hooks executing before
ediff-control-buffer; they should also leave
ediff-control-buffer as the current buffer when they finish.
Hooks that are executed after
ediff-cleanup-mess should expect
the current buffer be either buffer A or buffer B.
ediff-cleanup-mess doesn’t kill the buffers being compared or
This hook is run just before
ediff-quit-hook. This is a good
place to do various cleanups, such as deleting the variant buffers.
Ediff provides a helper function,
ediff-janitor, that you can
invoke from a private hook function. For example:
(defun my-ediff-janitor () (ediff-janitor nil nil)) (add-hook 'ediff-cleanup-hook #'my-ediff-janitor)
This function kills buffers A, B, and, possibly, C, if these buffers aren’t modified. In merge jobs, buffer C is never deleted. However, the side effect of using this function is that you may not be able to compare the same buffer in two separate Ediff sessions: quitting one of them will delete this buffer in another session as well.
This hook is called when Ediff quits a merge job. By default, the value is
ediff-maybe-save-and-delete-merge, which is a function that attempts
to save the merge buffer according to the value of
ediff-autostore-merges, as described later.
These two hooks run before and after Ediff sets up the control frame.
They can be used to relocate Ediff control frame when Ediff runs in a
multiframe mode (i.e., when the control buffer is in its own dedicated
frame). Be aware that many variables that drive Ediff are local to
Ediff Control Panel (
ediff-control-buffer), which requires
special care in writing these hooks. Take a look at
see what’s involved.
This hook is run at the end of Ediff startup.
This hook is run after Ediff selects the next difference region.
This hook is run after Ediff unselects the current difference region.
This hook is run for each Ediff buffer (A, B, C) right after the buffer is arranged.
Ediff runs this hook each time after setting up the help message. It can be used to alter the help message for custom packages that run on top of Ediff.
This hook is run just after Ediff mode is set up in the control buffer. This is done before any Ediff window is created. You can use it to set local variables that alter the look of the display.
Hooks run after setting up the registry for all active Ediff session. See Session Groups, for details.
Hooks run before setting up a control panel for a group of related Ediff sessions. Can be used, for example, to save window configuration to restore later.
Hooks run after setting up a control panel for a group of related Ediff sessions. See Session Groups, for details.
Hooks run just before exiting a session group.
Hooks run just after setting up the
map that controls key bindings in the meta buffer. Since
ediff-meta-buffer-map is a local variable, you can set different
bindings for different kinds of meta buffers.