The bulk of customization can be done via the following hooks:
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 of Ediff.
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
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.
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.
ediff-control-buffer), which requires special care in writing these hooks. Take a look at
ediff-default-quit-hookto see what's involved.
ediff-meta-buffer-map, the map that controls key bindings in the meta buffer. Since
ediff-meta-buffer-mapis a local variable, you can set different bindings for different kinds of meta buffers.