[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#15303: 24.3; [diff-mode] diff-hunk-kill doesn't update numbers in su
bug#15303: 24.3; [diff-mode] diff-hunk-kill doesn't update numbers in subsequent hunks
Mon, 09 Sep 2013 14:18:13 -0400
Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)
> That's actually wrong. The original hunk added three lines to the new
> file, so when it is killed, the new line number in the hunk header
> should be decreased by three, so the line should be
Indeed, currently, diff-mode does not try very hard (if at all) to keep
the line numbers correct, and instead presumes that the hunks will be
I might accept a patch which fixes this issue, but doing it right
(e.g. handle all the different kinds of hunks we support, disregard
subsequent hunks that apply to other files, ...) might prove too complex
for the benefit.
The problem also is that this presumes a particular use case (you get
a diff for file FOO, then you remove some of the hunks to extract
a sub-diff that will apply to the same file).
But there are other uses cases where the current behavior is "right".
E.g. I mainly use M-k in .rej files after I applied the corresponding
hunk by hand, in which case the subsequent hunks shouldn't be updated.
Admittedly, for a .rej file, the exact line numbers are often not quite
right, so it wouldn't make things worse to update subsequent hunks.