From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.bugs Subject: bug#17522: diff-mode frustrates attempt to correct corrupted diff file. Date: Thu, 22 May 2014 21:14:07 +0000 Message-ID: <20140522211407.GA3648@acm.acm> References: <20140518105055.GA3727@acm.acm> <20140521215636.GA3908@acm.acm> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1400793574 23648 80.91.229.3 (22 May 2014 21:19:34 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 22 May 2014 21:19:34 +0000 (UTC) Cc: 17522@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu May 22 23:19:25 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1WnaOY-0005aP-QH for geb-bug-gnu-emacs@m.gmane.org; Thu, 22 May 2014 23:19:22 +0200 Original-Received: from localhost ([::1]:39739 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WnaOY-0008LV-Af for geb-bug-gnu-emacs@m.gmane.org; Thu, 22 May 2014 17:19:22 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36625) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WnaOO-0008KM-2x for bug-gnu-emacs@gnu.org; Thu, 22 May 2014 17:19:19 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WnaOE-0002Ih-I6 for bug-gnu-emacs@gnu.org; Thu, 22 May 2014 17:19:12 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:58096) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WnaOE-0002Ib-F6 for bug-gnu-emacs@gnu.org; Thu, 22 May 2014 17:19:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1WnaOE-00077S-33 for bug-gnu-emacs@gnu.org; Thu, 22 May 2014 17:19:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 22 May 2014 21:19:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 17522 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 17522-submit@debbugs.gnu.org id=B17522.140079350727304 (code B ref 17522); Thu, 22 May 2014 21:19:02 +0000 Original-Received: (at 17522) by debbugs.gnu.org; 22 May 2014 21:18:27 +0000 Original-Received: from localhost ([127.0.0.1]:56973 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WnaNe-00076J-UM for submit@debbugs.gnu.org; Thu, 22 May 2014 17:18:27 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:30629 helo=mail.muc.de) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WnaNc-000766-3Y for 17522@debbugs.gnu.org; Thu, 22 May 2014 17:18:24 -0400 Original-Received: (qmail 91879 invoked by uid 3782); 22 May 2014 21:18:21 -0000 Original-Received: from acm.muc.de (pD951A2AC.dip0.t-ipconnect.de [217.81.162.172]) by colin.muc.de (tmda-ofmipd) with ESMTP; Thu, 22 May 2014 23:18:20 +0200 Original-Received: (qmail 3835 invoked by uid 1000); 22 May 2014 21:14:07 -0000 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:89374 Archived-At: Hi, Stefan. On Wed, May 21, 2014 at 09:32:11PM -0400, Stefan Monnier wrote: > >> If you add a space on that line, the count should be updated again and > >> start looking more sane. > > This is all besides the point. I did not edit the hunk header, > > therefore I don't expect it to be changed behind my back. If I need > > the header to be recalculated, surely there should be a command > > for that. > diff-mode tries to be fancier and do that transparently. Yes, but it sometimes fails, and then this "transparently" becomes a euphemism for "fouls it up in a manner causing the user the maximum difficulty in seeing what has happened". At this point you snipped the main point of my last post, which was this: > > At the very least, surely Diff Mode should _ask_ me before splatting > > my file. Or at the very, very least even _inform_ me that it has > > done so, rather than leaving it up to patch to issue its bewildering > > error message. So why can't we have a `y-or-n-p' or a `message' when diff-mode is about to change a hunk header, possibly fouling it up? It is the "fanciness" and "transparency" which caused me so much grief, the not realising that the hunk header had been automatically changed. It never occurred to me that Diff Mode might do something like this (except for a dim memory that something like this happened to me once before). > You're just bumping into a bug of that code (regardless of how the > empty-line is handled, a line count of 0 for both sides of the hunk is > clearly not right). Yes, but a line count of 1 for both sides, which might have happened if the blank line was the second line in the hunk rather than the first, would be equally not right. > BTW, I remember writing some kind of "fix corrupted hunk" code. > Oh, yes, it's in diff-sanity-check-hunk. Can you try to see if it can > auto-fix your corrupted patch? It's getting late. I'll have a look at this some time soon. > Stefan -- Alan Mackenzie (Nuremberg, Germany).