bug#81375: diff-refine-hunk over-refines large unrelated replacement blocks

Sean Whitton <[email protected]> Fri, 31 Jul 2026 14:32:14 +0100
Newsgroups gmane.emacs.bugs
Message-ID <[email protected]>
Umar Ahmad [19/Jul 11:57am +0530] wrote:
> I went ahead and turned the normalize-then-coalesce approach into a
> patch for smerge-mode.el.
>
> The patch adds a new user option, smerge-refine-policy.  Its default
> value is nil, which preserves the existing behavior.  Setting it to
> normalize-then-coalesce (I'm not sure about the name) first checks the
> original inner diff using the normalized-median-or-longest-run
> criterion.  If the refinement passes, adjacent changes separated by at
> most one common element are coalesced; otherwise, fine refinement for
> the pair is omitted.
>
> I tested the patch with the demo cases and ran the standard
> smerge-mode test target; all five tests pass.
>
> The patch is attached.  WDYT?

How about not introducing the smerge-refine-policy variable quite yet?
We can add it if and when we decide that it is worth having more than
one policy implemented and available for users.

-- 
Sean Whitton