bug#81375: diff-refine-hunk over-refines large unrelated replacement blocks
Sean Whitton <[email protected]> Fri, 31 Jul 2026 14:31:41 +0100
| Newsgroups | gmane.emacs.bugs |
|---|---|
| Message-ID | <[email protected]> |
Stefan Monnier [16/Jul 4:27pm -04] wrote: > Thanks for your demo, it's nice to see it in more concrete terms. > In your examples, the only cases where I find the refinement distracting > are case-05-total-rewrite add case-12-repeated-punctuation. Of course, > my opinion is biased from looking at such refinements for years, so I've > trained my brain to "ignore the noise". > > Looking at them and thinking about the problem again, I wonder if it > wouldn't be better to take a more local look at the problem, i.e. rather > than try to decide whether to refine this hunk or not, look at whether > some subhunks (by which I mean the hunks returned by the `diff` called > by `smerge-refine-region`, as opposed to the hunks to which we apply > `smerge-refine-region`) should be coalesced. > > E.g. for case-05-total-rewrite coalescing those subhunks that are separated > by a single-char token would remove most of the distraction. > > Taking such a more local approach could also help in "mixed" cases like > when a hunk is the result of a complete-rewrite of half a function and > reindentation of the other half. > > WDYT? Joining up hunks seems like something that ought to be diff(1)'s business, not Emacs? -- Sean Whitton