0

I am using smerge to resolve conflicts in my git repo.

I use C-c ^ n to jump to the next conflict. When I view the conflict, for all, I want to apply smerge-refine automatically.

Workflow should be: C-c ^ n and C-c ^ R , where I want C-c ^ R to be triggered automatically.

R   smerge-refine     Highlight the words of the conflict that are different.

Where is it possible to apply smerge-refine right for the all conflicts by default?

1 Answer 1

1
+50

If you set or customize diff-refine to a non-nil value then smerge-refine is applied "automatically" in smerge-next.

See the doc string of diff-refine for the valid values:

If non-nil, enable hunk refinement. The value font-lock means to refine during font-lock. The value navigation means to refine each hunk as you visit it with diff-hunk-next or diff-hunk-prev. You can always manually refine a hunk with diff-refine-hunk.

This answer is valid for Emacs 27.1 and higher.

4
  • Like (setq diff-refine t) ?
    – alper
    Mar 16, 2023 at 19:48
  • @alper I've added the doc string for diff-refine. smerge-next does not really care about the actual value it just checks that it is non-nil. Nevertheless, you should use one of the proposed options to make diff-mode work like expected.
    – Tobias
    Mar 16, 2023 at 19:52
  • So can I do something like: (setq diff-refine 'navigation) ?
    – alper
    Mar 17, 2023 at 10:54
  • @alper Yes, that is possible in your init file. But, you can also just customize and save the customization. With small things like that I do it that way.
    – Tobias
    Mar 17, 2023 at 13:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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