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

Sean Whitton <[email protected]> Fri, 31 Jul 2026 16:05:49 +0100
Newsgroups gmane.emacs.bugs
Message-ID <[email protected]>
Stefan Monnier [31/Jul 10:27am -04] wrote:
>> Joining up hunks seems like something that ought to be diff(1)'s
>> business, not Emacs?
>
> `diff` aims to give a "minimal" set of changes, defined by some cost
> measure, whereas what I find problematic in some cases of refinement is
> that some "minimal" set of changes ends up too "complex", so I'd prefer
> a suboptimal set.
>
> I'm not sure we can easily tweak `diff`s cost measure to get what
> we want, but it would be worth looking into it.  I think that's a much
> larger change because I can't see any command line option to control the
> cost measure, so it would require using some other tool.

Right.  But that's the GNU tool in which that work would belong, I
think.

> BTW, it might be worth looking into the (re)use of the diff code we're
> already using for `replace-region-contents`.

Interesting thought.

-- 
Sean Whitton