unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@IRO.UMontreal.CA>
To: Alan Mackenzie <acm@muc.de>
Cc: emacs-devel@gnu.org
Subject: Re: diff-mode: C-c C-c fails when location of hunk has been changed. C-d bound to backward-word.
Date: Mon, 26 May 2008 11:55:46 -0400	[thread overview]
Message-ID: <jwv3ao5awv6.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <20080526140422.GC4758@muc.de> (Alan Mackenzie's message of "Mon,  26 May 2008 14:04:22 +0000")

> In diff mode, whilst on a hunk, do C-c C-c.  This fails to find the
> changed text in the target buffer, because it is now too far away from
> where it was.  Fair enough.

Hmm... actually, it does an unbounded search, so it should find a place
if one exists.  It may not be the right one, of course.  Could you give
a detailed recipe to reproduce the problem?

> Now edit the diff hunk so that the line number is now correct.  I.e.,
> change:

> *** 2078,2084 ****

> to

> *** 2128,2134 ****

> .  Now do C-c C-c again.  Point is left at L2078 in the target buffer,
> not L2128.  THIS IS A BUG.

Could be.  Depends on a lot of things.  E.g. are the from&to file
names identical?  Is point in the `from' or the `to' part of the hunk?
Is the location of the hunk found?  What does the hunk look like?

> #########################################################################

> Whilst in the diff mode buffer, type C-d here:

> *** 2078,2084 ****
>            ^

> The apparent effect of this is backward-word.  This is unfriendly.
> (What actually happens is that an after-command hook recalculates 2084
> and splats it into position.)

> I think it would be better if diff-mode beeped with a message, e.g.

> "End of hunk line-number cannot be edited".

IIRC the after-command hook tries to stay out of the way if you touch
any of the headers.  Indeed, it seems to DTRT for unified hunks, but not
for context ones.  I'll take a look at it.


        Stefan




  reply	other threads:[~2008-05-26 15:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-26 14:04 diff-mode: C-c C-c fails when location of hunk has been changed. C-d bound to backward-word Alan Mackenzie
2008-05-26 15:55 ` Stefan Monnier [this message]
2008-05-26 17:29   ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwv3ao5awv6.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=acm@muc.de \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).