Subject: bug#17522: diff-mode frustrates attempt to correct corrupted diff file.

From: Stefan Monnier <[email-masked]>
Date: Sun, 25 May 2014 16:18:09 -0400

>> diff-mode.el was partly changed to accommodate that looser format, but
>> not 100%.
> Why not?

The usual: lack of time/motivation/...

> If you're going to carry on making surreptitious changes to
> hunk headers, you'll need to determine the start and end of hunks
> reliably, especially corrupted hunks.  This can't be done with 100%
> certainty, and is going to involve heuristics.  A good way might be to
> scan a hunk _forwards_ counting lines before the first change to that
> hunk.

Exactly, with a before-change-function.

And if the hunk is found to be borked, then try to at least not make
things worse (and maybe suggest the use of diff-sanity-check-hunk, after
we make it into a command).

        Stefan