Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

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:

  • the common ancestor (buffer A in kdiff3)
  • "ours" a.k.a. "local" (buffer B in kdiff3)
  • "theirs" a.k.a. "remote" (buffer C in kdiff3)
  • the merge result or target

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:

  • "ours" a.k.a. "local" (labelled buffer A)
  • "theirs" a.k.a. "remote" (labelled buffer B)
  • the merge result or target (labelled buffer C)

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?

like image 504
Adam Spiers Avatar asked Mar 23 '13 13:03

Adam Spiers


1 Answers

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.

like image 52
Tino Avatar answered Oct 05 '22 22:10

Tino