Adam Spiers
Adam Spiers

Reputation: 17916

Can ediff merge simultaneously show the ancestor, A, B, and merge buffers?

I'm a die-hard emacs user, but so far have always used kdiff3 for 3-way merges with ancestor, e.g. when performing git merge or rebase. I really like the way that kdiff3 can not only simultaneously display all four versions of the text being merged:

but also makes the differences between A, B, and C clear via colour highlighting. However, kdiff3 unsurprisingly sucks in comparison to emacs when it comes to text editing of the merge buffer, since kdiff3 is not a full-blown text editor. It also doesn't integrate out of the box with the excellent magit package. So I'm trying to switch to using ediff when resolving conflicts in this particular scenario (I have been successfully using ediff for other use cases for many years).

However, despite reading the ediff manual and EmacsWiki page, and asking on #emacs IRC, I can't find a way to simultaneously display all 4 buffers. By default it shows:

Pressing / switches the window displaying the merge result buffer (C) so that it displays the ancestor buffer, but you can't see the ancestor and the merge result simultaneously. (Also, the diff in the ancestor buffer is highlighted in a single colour which doesn't clearly show which bits differ from the other two visible buffers (A and B), although according to this thread, it seems that unfortunately ancestor diff refinement hasn't been implemented yet.)

Is there an easy way to configure ediff to simultaneously display all 4 buffers?

Upvotes: 21

Views: 2208

Answers (2)

Tino
Tino

Reputation: 444

This has being added to the trunk version. Now by default, 3-way merges show four buffers, i.e., "local" (buffer A), "remote" (buffer B), the merge result (buffer C) and the ancestor. You can change this default customizing the new option 'ediff-show-ancestor'.

The key '/' is now bound to a new command 'ediff-toggle-show-ancestor': it toggles whether to show 3 (local, remote and result) or 4 (local, remote, result, ancestor) buffers.

These changes will be visible in Emacs 26.1 release.

Upvotes: 6

db48x
db48x

Reputation: 3168

Nope, there's no easy way to just configure it to do that. There is the option ediff-window-setup-function, which you can customize to be any function you want. You can look at the defaults, ediff-setup-windows-plain and ediff-setup-windows-multi to get an idea of what you'll need to do. In fact, the easiest way to proceed will be to copy one of them into your emacs config and modify it (changing the name, of course); they're not trivial.

Upvotes: 1

Related Questions