GNU bug report logs - #15303
24.3; [diff-mode] diff-hunk-kill doesn't update numbers in subsequent hunks

Previous Next

Package: emacs;

Reported by: mcepl <at> redhat.com (Matěj Cepl)

Date: Sat, 7 Sep 2013 22:06:02 UTC

Severity: wishlist

Found in version 24.3

Full log


Message #8 received at 15303 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: mcepl <at> redhat.com (Matěj Cepl)
Cc: 15303 <at> debbugs.gnu.org
Subject: Re: bug#15303: 24.3;
 [diff-mode] diff-hunk-kill doesn't update numbers in subsequent hunks
Date: Mon, 09 Sep 2013 14:18:13 -0400
> 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
applied "fuzzily".

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.


        Stefan




This bug report was last modified 11 years and 279 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.