unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#4368: 23.1; diff-hunk-kill -vs- final hunk in a file
@ 2009-09-08  4:13 ` Tom Tromey
  2009-09-08  9:14   ` Andreas Schwab
                     ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Tom Tromey @ 2009-09-08  4:13 UTC (permalink / raw)
  To: bug-gnu-emacs


Please write in English if possible, because the Emacs maintainers
usually do not have translators to read other languages for them.

Your bug report will be posted to the bug-gnu-emacs@gnu.org mailing list,
and to the gnu.emacs.bug news group.

Please describe exactly what actions triggered the bug
and the precise symptoms of the bug:


I'm using diff-mode to edit a patch.
The patch was generated by "git diff".
I typed M-k to remove the last hunk in a file.
However, it left the "header" around:

    diff --git a/src/data.c b/src/data.c
    index 7b59673..9063cef 100644
    --- a/src/data.c
    +++ b/src/data.c
    diff --git a/src/eval.c b/src/eval.c
    index 4b7aa32..dbaa385 100644
    --- a/src/eval.c
    [...]

This yielded an invalid patch.


If Emacs crashed, and you have the Emacs process in the gdb debugger,
please include the output from the following gdb commands:
    `bt full' and `xbacktrace'.
If you would like to further debug the crash, please read the file
/usr/share/emacs/23.1/etc/DEBUG for instructions.


In GNU Emacs 23.1.1 (i386-redhat-linux-gnu, GTK+ Version 2.16.5)
 of 2009-08-24 on x86-2.fedora.phx.redhat.com
Windowing system distributor `The X.Org Foundation', version 11.0.10601901
configured using `configure  '--build=i386-redhat-linux-gnu' '--host=i386-redhat-linux-gnu' '--target=i586-redhat-linux-gnu' '--program-prefix=' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/var/lib' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--with-dbus' '--with-gif' '--with-jpeg' '--with-png' '--with-rsvg' '--with-tiff' '--with-xft' '--with-xpm' '--with-x-toolkit=gtk' 'build_alias=i386-redhat-linux-gnu' 'host_alias=i386-redhat-linux-gnu' 'target_alias=i586-redhat-linux-gnu' 'CFLAGS=-DMAIL_USE_LOCKF -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-bu
 ffer-size=4 -m32 -march=i586 -mtune=generic -fasynchronous-unwind-tables''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default-enable-multibyte-characters: t

Major mode: Diff

Minor modes in effect:
  shell-dirtrack-mode: t
  diff-auto-refine-mode: t
  erc-list-mode: t
  erc-menu-mode: t
  erc-autojoin-mode: t
  erc-ring-mode: t
  erc-pcomplete-mode: t
  erc-track-mode: t
  erc-track-minor-mode: t
  erc-match-mode: t
  erc-button-mode: t
  erc-fill-mode: t
  erc-stamp-mode: t
  erc-netsplit-mode: t
  erc-spelling-mode: t
  erc-truncate-mode: t
  erc-status-mode: t
  erc-services-mode: t
  erc-networks-mode: t
  erc-irccontrols-mode: t
  erc-noncommands-mode: t
  erc-move-to-prompt-mode: t
  erc-readonly-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  global-auto-composition-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
g i t - r e v e r t RET C-x o C-x 1 C-v C-v C-l ESC 
v C-x b * s h TAB RET f r o m RET C-x b RET C-l ESC 
v C-h u g i t - r e s e t RET C-x o C-x 1 C-v C-v C-v 
C-v C-v k C-x b * s h TAB RET C-r 8 a 9 C-w C-r C-r 
C-r C-r C-x C-f / t m p / L RET C-s C-s C-a ESC v ESC 
v ESC v ESC v C-x b RET ESC p ESC p ESC DEL Q ESC b 
ESC b ESC b ESC b ESC t C-_ ESC f ESC t RET C-x C-f 
/ t m p / Q RET C-v C-v C-x k RET g i t C-a C-k . RET 
g i t SPC a p p l y SPC / t m p / Q RET g i t SPC s 
t a t u s RET C-c C-o g i t SPC c o m m i t SPC - a 
SPC - m ' r e v e r t SPC a SPC f e w SPC p a t c h 
e s SPC b y SPC h n d DEL DEL a n d ' RET g i t SPC 
a p p l y SPC t / DEL DEL / t m p / P RET C-x C-f / 
t m p / P RET C-c g 1 4 6 RET ESC x r e p o r t - e 
m TAB b TAB RET d i f f - C-g C-h k ESC k ESC x r e 
p o r t - e m TAB b TAB RET

Recent messages:
Please wait: formatting the git-reset man page...
git-reset man page formatted
Mark saved where search started [2 times]
call-interactively: Beginning of buffer [4 times]
History item: 1
History item: 2
Undo!
Mark set
Quit
Type C-x 1 to delete the help window.

Tom






^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#4368: 23.1; diff-hunk-kill -vs- final hunk in a file
  2009-09-08  4:13 ` bug#4368: 23.1; diff-hunk-kill -vs- final hunk in a file Tom Tromey
@ 2009-09-08  9:14   ` Andreas Schwab
  2009-09-08 15:43     ` Tom Tromey
  2009-09-08 21:47   ` Stefan Monnier
  2009-09-09 14:55   ` bug#4368: marked as done (23.1; diff-hunk-kill -vs- final hunk in a file) Emacs bug Tracking System
  2 siblings, 1 reply; 6+ messages in thread
From: Andreas Schwab @ 2009-09-08  9:14 UTC (permalink / raw)
  To: Tom Tromey; +Cc: 4368, bug-gnu-emacs

Tom Tromey <tromey@redhat.com> writes:

> I'm using diff-mode to edit a patch.
> The patch was generated by "git diff".
> I typed M-k to remove the last hunk in a file.
> However, it left the "header" around:

Use M-K instead, this will also remove the header.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#4368: 23.1; diff-hunk-kill -vs- final hunk in a file
  2009-09-08  9:14   ` Andreas Schwab
@ 2009-09-08 15:43     ` Tom Tromey
  0 siblings, 0 replies; 6+ messages in thread
From: Tom Tromey @ 2009-09-08 15:43 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: 4368, bug-gnu-emacs

>>>>> "Andreas" == Andreas Schwab <schwab@linux-m68k.org> writes:

>> I'm using diff-mode to edit a patch.
>> The patch was generated by "git diff".
>> I typed M-k to remove the last hunk in a file.
>> However, it left the "header" around:

Andreas> Use M-K instead, this will also remove the header.

Yeah, I knew about M-K.  I was editing the patch, deleting hunks
one-by-one, and I didn't notice that I was about to delete the last hunk
from a file.  It would be nicer if diff-mode handled this for me, so
that I didn't accidentally create a bogus patch.

Tom





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#4368: 23.1; diff-hunk-kill -vs- final hunk in a file
  2009-09-08  4:13 ` bug#4368: 23.1; diff-hunk-kill -vs- final hunk in a file Tom Tromey
  2009-09-08  9:14   ` Andreas Schwab
@ 2009-09-08 21:47   ` Stefan Monnier
  2009-09-09  2:27     ` Tom Tromey
  2009-09-09 14:55   ` bug#4368: marked as done (23.1; diff-hunk-kill -vs- final hunk in a file) Emacs bug Tracking System
  2 siblings, 1 reply; 6+ messages in thread
From: Stefan Monnier @ 2009-09-08 21:47 UTC (permalink / raw)
  To: Tom Tromey; +Cc: 4368

> I'm using diff-mode to edit a patch.
> The patch was generated by "git diff".
> I typed M-k to remove the last hunk in a file.
> However, it left the "header" around:

>     diff --git a/src/data.c b/src/data.c
>     index 7b59673..9063cef 100644
>     --- a/src/data.c
>     +++ b/src/data.c
>     diff --git a/src/eval.c b/src/eval.c
>     index 4b7aa32..dbaa385 100644
>     --- a/src/eval.c
>     [...]

Can you show the content before the last M-k ?


        Stefan





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#4368: 23.1; diff-hunk-kill -vs- final hunk in a file
  2009-09-08 21:47   ` Stefan Monnier
@ 2009-09-09  2:27     ` Tom Tromey
  0 siblings, 0 replies; 6+ messages in thread
From: Tom Tromey @ 2009-09-09  2:27 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 4368

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.

Tom

diff --git a/src/lisp.h b/src/lisp.h
index 4807794..c619bcf 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -1545,6 +1519,7 @@ typedef struct {
 #define SUB_CHAR_TABLE_P(x) PSEUDOVECTORP (x, PVEC_SUB_CHAR_TABLE)
 #define BOOL_VECTOR_P(x) PSEUDOVECTORP (x, PVEC_BOOL_VECTOR)
 #define FRAMEP(x) PSEUDOVECTORP (x, PVEC_FRAME)
+#define THREADP(x) PSEUDOVECTORP (x, PVEC_THREAD)
 
 /* Test for image (image . spec)  */
 #define IMAGEP(x) (CONSP (x) && EQ (XCAR (x), Qimage))
diff --git a/src/window.c b/src/window.c
index 1b2305d..283dcff 100644
--- a/src/window.c
+++ b/src/window.c
@@ -5898,7 +5898,7 @@ struct save_window_data
     struct Lisp_Vector *next_from_Lisp_Vector_struct;
     Lisp_Object selected_frame;
     Lisp_Object current_window;
-    Lisp_Object current_buffer;
+    Lisp_Object m_current_buffer;
     Lisp_Object minibuf_scroll_window;
     Lisp_Object minibuf_selected_window;
     Lisp_Object root_window;





^ permalink raw reply related	[flat|nested] 6+ messages in thread

* bug#4368: marked as done (23.1; diff-hunk-kill -vs- final hunk in a file)
  2009-09-08  4:13 ` bug#4368: 23.1; diff-hunk-kill -vs- final hunk in a file Tom Tromey
  2009-09-08  9:14   ` Andreas Schwab
  2009-09-08 21:47   ` Stefan Monnier
@ 2009-09-09 14:55   ` Emacs bug Tracking System
  2 siblings, 0 replies; 6+ messages in thread
From: Emacs bug Tracking System @ 2009-09-09 14:55 UTC (permalink / raw)
  To: Stefan Monnier

[-- Attachment #1: Type: text/plain, Size: 907 bytes --]

Your message dated Wed, 09 Sep 2009 10:49:29 -0400
with message-id <jwv63bsqimn.fsf-monnier+emacsbugreports@gnu.org>
and subject line Re: bug#4368: 23.1; diff-hunk-kill -vs- final hunk in a file
has caused the Emacs bug report #4368,
regarding 23.1; diff-hunk-kill -vs- final hunk in a file
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@emacsbugs.donarmstrong.com
immediately.)


-- 
4368: http://emacsbugs.donarmstrong.com/cgi-bin/bugreport.cgi?bug=4368
Emacs Bug Tracking System
Contact owner@emacsbugs.donarmstrong.com with problems

[-- Attachment #2: Type: message/rfc822, Size: 6959 bytes --]

From: Tom Tromey <tromey@redhat.com>
To: bug-gnu-emacs@gnu.org
Subject: 23.1; diff-hunk-kill -vs- final hunk in a file
Date: Mon, 07 Sep 2009 22:13:27 -0600
Message-ID: <m3pra213bs.fsf@fleche.redhat.com>


Please write in English if possible, because the Emacs maintainers
usually do not have translators to read other languages for them.

Your bug report will be posted to the bug-gnu-emacs@gnu.org mailing list,
and to the gnu.emacs.bug news group.

Please describe exactly what actions triggered the bug
and the precise symptoms of the bug:


I'm using diff-mode to edit a patch.
The patch was generated by "git diff".
I typed M-k to remove the last hunk in a file.
However, it left the "header" around:

    diff --git a/src/data.c b/src/data.c
    index 7b59673..9063cef 100644
    --- a/src/data.c
    +++ b/src/data.c
    diff --git a/src/eval.c b/src/eval.c
    index 4b7aa32..dbaa385 100644
    --- a/src/eval.c
    [...]

This yielded an invalid patch.


If Emacs crashed, and you have the Emacs process in the gdb debugger,
please include the output from the following gdb commands:
    `bt full' and `xbacktrace'.
If you would like to further debug the crash, please read the file
/usr/share/emacs/23.1/etc/DEBUG for instructions.


In GNU Emacs 23.1.1 (i386-redhat-linux-gnu, GTK+ Version 2.16.5)
 of 2009-08-24 on x86-2.fedora.phx.redhat.com
Windowing system distributor `The X.Org Foundation', version 11.0.10601901
configured using `configure  '--build=i386-redhat-linux-gnu' '--host=i386-redhat-linux-gnu' '--target=i586-redhat-linux-gnu' '--program-prefix=' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/var/lib' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--with-dbus' '--with-gif' '--with-jpeg' '--with-png' '--with-rsvg' '--with-tiff' '--with-xft' '--with-xpm' '--with-x-toolkit=gtk' 'build_alias=i386-redhat-linux-gnu' 'host_alias=i386-redhat-linux-gnu' 'target_alias=i586-redhat-linux-gnu' 'CFLAGS=-DMAIL_USE_LOCKF -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-bu
 ffer-size=4 -m32 -march=i586 -mtune=generic -fasynchronous-unwind-tables''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default-enable-multibyte-characters: t

Major mode: Diff

Minor modes in effect:
  shell-dirtrack-mode: t
  diff-auto-refine-mode: t
  erc-list-mode: t
  erc-menu-mode: t
  erc-autojoin-mode: t
  erc-ring-mode: t
  erc-pcomplete-mode: t
  erc-track-mode: t
  erc-track-minor-mode: t
  erc-match-mode: t
  erc-button-mode: t
  erc-fill-mode: t
  erc-stamp-mode: t
  erc-netsplit-mode: t
  erc-spelling-mode: t
  erc-truncate-mode: t
  erc-status-mode: t
  erc-services-mode: t
  erc-networks-mode: t
  erc-irccontrols-mode: t
  erc-noncommands-mode: t
  erc-move-to-prompt-mode: t
  erc-readonly-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  global-auto-composition-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
g i t - r e v e r t RET C-x o C-x 1 C-v C-v C-l ESC 
v C-x b * s h TAB RET f r o m RET C-x b RET C-l ESC 
v C-h u g i t - r e s e t RET C-x o C-x 1 C-v C-v C-v 
C-v C-v k C-x b * s h TAB RET C-r 8 a 9 C-w C-r C-r 
C-r C-r C-x C-f / t m p / L RET C-s C-s C-a ESC v ESC 
v ESC v ESC v C-x b RET ESC p ESC p ESC DEL Q ESC b 
ESC b ESC b ESC b ESC t C-_ ESC f ESC t RET C-x C-f 
/ t m p / Q RET C-v C-v C-x k RET g i t C-a C-k . RET 
g i t SPC a p p l y SPC / t m p / Q RET g i t SPC s 
t a t u s RET C-c C-o g i t SPC c o m m i t SPC - a 
SPC - m ' r e v e r t SPC a SPC f e w SPC p a t c h 
e s SPC b y SPC h n d DEL DEL a n d ' RET g i t SPC 
a p p l y SPC t / DEL DEL / t m p / P RET C-x C-f / 
t m p / P RET C-c g 1 4 6 RET ESC x r e p o r t - e 
m TAB b TAB RET d i f f - C-g C-h k ESC k ESC x r e 
p o r t - e m TAB b TAB RET

Recent messages:
Please wait: formatting the git-reset man page...
git-reset man page formatted
Mark saved where search started [2 times]
call-interactively: Beginning of buffer [4 times]
History item: 1
History item: 2
Undo!
Mark set
Quit
Type C-x 1 to delete the help window.

Tom



[-- Attachment #3: Type: message/rfc822, Size: 3019 bytes --]

From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Tom Tromey <tromey@redhat.com>
Subject: Re: bug#4368: 23.1; diff-hunk-kill -vs- final hunk in a file
Date: Wed, 09 Sep 2009 10:49:29 -0400
Message-ID: <jwv63bsqimn.fsf-monnier+emacsbugreports@gnu.org>

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)

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-09-09 14:55 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <jwv63bsqimn.fsf-monnier+emacsbugreports@gnu.org>
2009-09-08  4:13 ` bug#4368: 23.1; diff-hunk-kill -vs- final hunk in a file Tom Tromey
2009-09-08  9:14   ` Andreas Schwab
2009-09-08 15:43     ` Tom Tromey
2009-09-08 21:47   ` Stefan Monnier
2009-09-09  2:27     ` Tom Tromey
2009-09-09 14:55   ` bug#4368: marked as done (23.1; diff-hunk-kill -vs- final hunk in a file) Emacs bug Tracking System

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).