1

When using ediff, I often get conflicts like this:

<<<<<<< variant A
added_function_1 () {
=======
added_function_2 () {
>>>>>>> variant B
<<<<<<< variant A
    body1
=======
    body2
>>>>>>> variant B
}

when I expect this:

<<<<<<< variant A
added_function_1 () {
    body1...
=======
added_function_2 () {
    body2...
>>>>>>> variant B
}

Ediff created two chunks where I expected only one. Is there a way to merge them?

This also happens with smerge-ediff, it actually splits up the chunks the diff tool generated.


What I actually want is of course

<<<<<<< variant A
added_function_1 () {
    body1...
}
=======
added_function_2 () {
    body2...
}
>>>>>>> variant B

but I guess that would require semantic diffing.

  • When I use your simple example, I get the expected merge. What version of emacs are you using? – Melioratus Oct 21 at 20:30
  • Are you looking for this + -combine diff regions feature? – Melioratus Oct 21 at 20:40
1

I think you're looking for M-x smerge-combine-with-next RET.

  • Pretty much, it doesn't work in Ediff though. When I try -- in the C buffer and inside a chunk -- I get "Point not in conflict region". – Erik Oct 20 at 11:33
  • @Erik: I don't understand what you mean by "in Ediff" because the sample conflicts you show should never appear within Ediff unless you're "ediffing" different files/versions each (or at least some) of which contains such conflict markers (which is usually a sign of a problem elsewhere such as using Ediff on the wrong files). – Stefan Oct 20 at 14:06
  • This specific conflicts may not appear in Ediff, I made them up to illustrate the problem. Conflict markers do appear in Ediff's buffer C. Even if this representation of the conflicts never appeared in Ediff, the conflicts themselves could. – Erik Oct 20 at 14:13
  • AFAIK Ediff's buffer C contains the ancestor, which shouldn't contain conflict markers either. Of course, it also all depends on what you mean by "using ediff". As it stands, your problem description seems too vague to be answerable. – Stefan Oct 20 at 18:46
  • When there is no ancestor, buffer C contains the result. I don't think my question is that hard to understand for someone familiar with Ediff. – Erik Oct 20 at 18:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.