all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Index header in diff-mode
@ 2005-12-08  7:44 Juri Linkov
  2005-12-08 16:46 ` Stefan Monnier
  0 siblings, 1 reply; 5+ messages in thread
From: Juri Linkov @ 2005-12-08  7:44 UTC (permalink / raw)


cvs diff generates index headers that look like

Index: lisp/simple.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/simple.el,v
retrieving revision 1.777
diff -u -r1.777 simple.el

After saving them to files and visiting in diff-mode, sometimes I type
`C-c C-c' or `RET' on such index headers with the intention to visit the
first hunk.  But instead, it visits the last hunk of the previous file
in the same multi-file diff.  Wouldn't it be better to handle the index
header as part of the file header?

-- 
Juri Linkov
http://www.jurta.org/emacs/

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

* Re: Index header in diff-mode
  2005-12-08  7:44 Index header in diff-mode Juri Linkov
@ 2005-12-08 16:46 ` Stefan Monnier
  2005-12-09  9:55   ` Juri Linkov
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Monnier @ 2005-12-08 16:46 UTC (permalink / raw)
  Cc: emacs-devel

> cvs diff generates index headers that look like
> Index: lisp/simple.el
> ===================================================================
> RCS file: /cvsroot/emacs/emacs/lisp/simple.el,v
> retrieving revision 1.777
> diff -u -r1.777 simple.el

> After saving them to files and visiting in diff-mode, sometimes I type
> `C-c C-c' or `RET' on such index headers with the intention to visit the
> first hunk.  But instead, it visits the last hunk of the previous file
> in the same multi-file diff.  Wouldn't it be better to handle the index
> header as part of the file header?

I think you're right.  Feel free to make this change,


        Stefan

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

* Re: Index header in diff-mode
  2005-12-08 16:46 ` Stefan Monnier
@ 2005-12-09  9:55   ` Juri Linkov
  2005-12-09 14:38     ` Stefan Monnier
  0 siblings, 1 reply; 5+ messages in thread
From: Juri Linkov @ 2005-12-09  9:55 UTC (permalink / raw)
  Cc: emacs-devel

>> After saving them to files and visiting in diff-mode, sometimes I type
>> `C-c C-c' or `RET' on such index headers with the intention to visit the
>> first hunk.  But instead, it visits the last hunk of the previous file
>> in the same multi-file diff.  Wouldn't it be better to handle the index
>> header as part of the file header?
>
> I think you're right.  Feel free to make this change,

I tried to add an optional Index regexp to diff-file-header-re:

(defconst diff-file-header-re
  (concat
   "^\\(Index: .+\n=+\n.+\n.+\n.+\n\\)?"
   "\\(--- .+\n\\+\\+\\+ \\|\\*\\*\\* .+\n--- \\|[^-+!<>0-9@* ]\\).+\n"
   (substring diff-hunk-header-re 1)))

but it works only in forward direction.  When using M-P to go to the
beginning of the previous diff file, it doesn't set point at the
beginning of regexp's part inside `\\(Index...\\)?'.  It sets point
after it.  I understand this is how re-search-backward currently
works, but is there a way to make backward search more "greedy"?

The same problem also causes wrong lazy-highlighting in isearch.
E.g. after starting isearch at the beginning of:

   abcabc

and typing `C-M-s a?b C-s C-r', "ab" is highlighted in lazy-highlight face,
but only "b" in isearch face.

-- 
Juri Linkov
http://www.jurta.org/emacs/

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

* Re: Index header in diff-mode
  2005-12-09  9:55   ` Juri Linkov
@ 2005-12-09 14:38     ` Stefan Monnier
  2005-12-09 23:55       ` Juri Linkov
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Monnier @ 2005-12-09 14:38 UTC (permalink / raw)
  Cc: emacs-devel

>>> After saving them to files and visiting in diff-mode, sometimes I type
>>> `C-c C-c' or `RET' on such index headers with the intention to visit the
>>> first hunk.  But instead, it visits the last hunk of the previous file
>>> in the same multi-file diff.  Wouldn't it be better to handle the index
>>> header as part of the file header?
>> 
>> I think you're right.  Feel free to make this change,

> I tried to add an optional Index regexp to diff-file-header-re:

I think it's the wrong way to go.  You should try and fix
diff-goto-source more specifically.


        Stefan

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

* Re: Index header in diff-mode
  2005-12-09 14:38     ` Stefan Monnier
@ 2005-12-09 23:55       ` Juri Linkov
  0 siblings, 0 replies; 5+ messages in thread
From: Juri Linkov @ 2005-12-09 23:55 UTC (permalink / raw)
  Cc: emacs-devel

>>>> After saving them to files and visiting in diff-mode, sometimes I type
>>>> `C-c C-c' or `RET' on such index headers with the intention to visit the
>>>> first hunk.  But instead, it visits the last hunk of the previous file
>>>> in the same multi-file diff.  Wouldn't it be better to handle the index
>>>> header as part of the file header?
>>>
>>> I think you're right.  Feel free to make this change,
>
>> I tried to add an optional Index regexp to diff-file-header-re:
>
> I think it's the wrong way to go.  You should try and fix
> diff-goto-source more specifically.

Yes, diff-goto-source should be fixed too, because currently it
doesn't work even on normal diff file headers.  But I thought also
that diff-file-next and diff-file-prev should stop at the index header
because some other commands like diff-file-kill already take into
account the index header.

-- 
Juri Linkov
http://www.jurta.org/emacs/

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

end of thread, other threads:[~2005-12-09 23:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-12-08  7:44 Index header in diff-mode Juri Linkov
2005-12-08 16:46 ` Stefan Monnier
2005-12-09  9:55   ` Juri Linkov
2005-12-09 14:38     ` Stefan Monnier
2005-12-09 23:55       ` Juri Linkov

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.