unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Dmitriy Blinov <bda@mns.spb.ru>
Cc: 1537@emacsbugs.donarmstrong.com, bug-gnu-emacs@gnu.org
Subject: bug#1537: diff-mode for git patches trouble
Date: Thu, 11 Dec 2008 14:04:58 -0500	[thread overview]
Message-ID: <jwvskou5ywu.fsf-monnier+emacsbugreports@gnu.org> (raw)
In-Reply-To: <494110EB.3040600@mns.spb.ru> (Dmitriy Blinov's message of "Thu,  11 Dec 2008 16:08:59 +0300")

> The last but one line is two minuses by default.  And diff-mode
> recognizes first minus as deleted string.  Therefore when we change
> some strings in patch, emacs creates malformed hunk offset.  It will
> be @@ -6,8 +6,7 @@ insead of correct @@ -6,7 +6,7 @@ after patch
> edition (if we don't delete/create strings).

> Is it possible to fix this harm or I should append whitespace before "--"
> string always?

Given the way the code is currently implemented, it's difficult to fix
this problem.  One of the problem is that we currently don't do anything
special before the user modifies the buffer.  Not even in
a before-change-function.  So by the time we try to update the hunk
header, the buffer has been modified and we don't know what it looked
like before.
I.e. to fix it we'll need to mark the end-of-hunk before the buffer is
really modified.  E.g. by automatically adding an empty line at
end-of-hunk (or a marker).

Of course, in the general case the problem is insoluble (e.g. if you
edit the line with the "--"), but clearly we can do better in the
"normal" case.


        Stefan






  reply	other threads:[~2008-12-11 19:04 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-11 13:08 bug#1537: diff-mode for git patches trouble Dmitriy Blinov
2008-12-11 19:04 ` Stefan Monnier [this message]
2008-12-12  6:57   ` Dmitriy Blinov
2008-12-12 19:08     ` Stefan Monnier
2008-12-12 19:15       ` Processed: " Emacs bug Tracking System
2020-08-16 17:00 ` bug#1536: " Stefan Kangas
2020-10-14  6:08   ` bug#1537: " Lars Ingebrigtsen

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=jwvskou5ywu.fsf-monnier+emacsbugreports@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=1537@emacsbugs.donarmstrong.com \
    --cc=bda@mns.spb.ru \
    --cc=bug-gnu-emacs@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).