From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#1537: diff-mode for git patches trouble Date: Thu, 11 Dec 2008 14:04:58 -0500 Message-ID: References: <494110EB.3040600@mns.spb.ru> Reply-To: Stefan Monnier , 1537@emacsbugs.donarmstrong.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1229023496 6858 80.91.229.12 (11 Dec 2008 19:24:56 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 11 Dec 2008 19:24:56 +0000 (UTC) Cc: 1537@emacsbugs.donarmstrong.com, bug-gnu-emacs@gnu.org To: Dmitriy Blinov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Dec 11 20:25:58 2008 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1LArAL-0003ye-LY for geb-bug-gnu-emacs@m.gmane.org; Thu, 11 Dec 2008 20:25:41 +0100 Original-Received: from localhost ([127.0.0.1]:60130 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LAr9A-0003jV-0W for geb-bug-gnu-emacs@m.gmane.org; Thu, 11 Dec 2008 14:24:28 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LAr95-0003iY-Qh for bug-gnu-emacs@gnu.org; Thu, 11 Dec 2008 14:24:23 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LAr93-0003he-Ob for bug-gnu-emacs@gnu.org; Thu, 11 Dec 2008 14:24:22 -0500 Original-Received: from [199.232.76.173] (port=52890 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LAr93-0003hR-LX for bug-gnu-emacs@gnu.org; Thu, 11 Dec 2008 14:24:21 -0500 Original-Received: from rzlab.ucr.edu ([138.23.92.77]:35667) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LAr92-0007kJ-V6 for bug-gnu-emacs@gnu.org; Thu, 11 Dec 2008 14:24:21 -0500 Original-Received: from rzlab.ucr.edu (rzlab.ucr.edu [127.0.0.1]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id mBBJOIws015143; Thu, 11 Dec 2008 11:24:18 -0800 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.13.8/8.13.8/Submit) id mBBJA6gP010406; Thu, 11 Dec 2008 11:10:06 -0800 X-Loop: don@donarmstrong.com Resent-From: Stefan Monnier Resent-To: bug-submit-list@donarmstrong.com Resent-CC: Emacs Bugs Resent-Date: Thu, 11 Dec 2008 19:10:06 +0000 Resent-Message-ID: Resent-Sender: don@donarmstrong.com X-Emacs-PR-Message: report 1537 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Original-Received: via spool by 1537-submit@emacsbugs.donarmstrong.com id=B1537.12290223098822 (code B ref 1537); Thu, 11 Dec 2008 19:10:06 +0000 X-Spam-Bayes: score:0.0000 Tokens: new, 2; hammy, 145; neutral, 62; spammy, 0. spammytokens: hammytokens:0.000-+--emacs, 0.000-+--H*M:fsf, 0.000-+--H*UA:Emacs, 0.000-+--H*u:Emacs, 0.000-+--H*UA:Gnus Original-Received: (at 1537) by emacsbugs.donarmstrong.com; 11 Dec 2008 19:05:09 +0000 Original-Received: from ironport2-out.teksavvy.com (ironport2-out.pppoe.ca [206.248.154.182]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id mBBJ5499007823 for <1537@emacsbugs.donarmstrong.com>; Thu, 11 Dec 2008 11:05:05 -0800 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AkcFAO/yQElLd+2g/2dsb2JhbACBbMxqgnmBLA X-IronPort-AV: E=Sophos;i="4.36,206,1228107600"; d="scan'208";a="30934199" Original-Received: from 75-119-237-160.dsl.teksavvy.com (HELO pastel.home) ([75.119.237.160]) by ironport2-out.teksavvy.com with ESMTP; 11 Dec 2008 14:04:58 -0500 Original-Received: by pastel.home (Postfix, from userid 20848) id 2213886F6; Thu, 11 Dec 2008 14:04:58 -0500 (EST) In-Reply-To: <494110EB.3040600@mns.spb.ru> (Dmitriy Blinov's message of "Thu, 11 Dec 2008 16:08:59 +0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) X-CrossAssassin-Score: 2 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) Resent-Date: Thu, 11 Dec 2008 14:24:22 -0500 X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:23196 Archived-At: > 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