GNU bug report logs -
#4368
23.1; diff-hunk-kill -vs- final hunk in a file
Previous Next
Reported by: Tom Tromey <tromey <at> redhat.com>
Date: Tue, 8 Sep 2009 04:20:05 UTC
Severity: normal
Done: Stefan Monnier <monnier <at> iro.umontreal.ca>
Bug is archived. No further changes may be made.
Full log
Message #40 received at 4368-done <at> emacsbugs.donarmstrong.com (full text, mbox):
Stefan> Can you show the content before the last M-k ?
> The appended is a sample diff. I just grabbed a couple random hunks
> from the actual diff I was editing. It was originally made by git.
> Put it in a file, then M-x diff-mode.
> M-n to go to the first @@.
> M-k.
> You will see that all the header info from lisp.h remains in the buffer.
> I don't think you even need the second file diff in there to see this, a
> single file will do.
Hmm... indeed it fails all the time. Yet, I'm sure it used to work.
Anyway, the patch below seems to fix it.
Thanks,
Stefan
Index: lisp/diff-mode.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/diff-mode.el,v
retrieving revision 1.161
diff -u -r1.161 diff-mode.el
--- lisp/diff-mode.el 1 Sep 2009 07:24:18 -0000 1.161
+++ lisp/diff-mode.el 9 Sep 2009 14:47:45 -0000
@@ -546,7 +546,8 @@
(interactive)
(diff-beginning-of-hunk)
(let* ((start (point))
- (nexthunk (when (re-search-forward diff-hunk-header-re nil t)
+ ;; Search the second match, since we're looking at the first.
+ (nexthunk (when (re-search-forward diff-hunk-header-re nil t 2)
(match-beginning 0)))
(firsthunk (ignore-errors
(goto-char start)
This bug report was last modified 15 years and 341 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.