GNU bug report logs - #5352
diff-jump-to-old-file inverts hunk application as well

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Michael Orlitzky <michael@HIDDEN>; dated Mon, 11 Jan 2010 06:34:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 11 Jan 2010 06:33:04 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jan 11 01:33:03 2010
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1NUDpn-0007Pi-Iv
	for submit <at> debbugs.gnu.org; Mon, 11 Jan 2010 01:33:03 -0500
Received: from fencepost.gnu.org ([140.186.70.10])
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <michael@HIDDEN>) id 1NUC3x-0006Bh-Cz
	for submit <at> debbugs.gnu.org; Sun, 10 Jan 2010 23:39:34 -0500
Received: from mx10.gnu.org ([199.232.76.166]:36535)
	by fencepost.gnu.org with esmtp (Exim 4.69)
	(envelope-from <michael@HIDDEN>) id 1NUC3u-0004jC-0y
	for submit <at> debbugs.gnu.org; Sun, 10 Jan 2010 23:39:30 -0500
Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim
	4.60) (envelope-from <michael@HIDDEN>) id 1NUC3s-0004aC-V9
	for submit <at> debbugs.gnu.org; Sun, 10 Jan 2010 23:39:29 -0500
X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on monty-python
X-Spam-Level: 
X-Spam-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00,
	UNPARSEABLE_RELAY autolearn=ham version=3.1.0
Received: from lists.gnu.org ([199.232.76.165]:57761)
	by monty-python.gnu.org with esmtps
	(TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60)
	(envelope-from <michael@HIDDEN>) id 1NUC3s-0004a6-Pq
	for submit <at> debbugs.gnu.org; Sun, 10 Jan 2010 23:39:28 -0500
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1NUC3s-0006PN-DS
	for bug-gnu-emacs@HIDDEN; Sun, 10 Jan 2010 23:39:28 -0500
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1NUC3n-0006Jj-Mw
	for bug-gnu-emacs@HIDDEN; Sun, 10 Jan 2010 23:39:28 -0500
Received: from [199.232.76.173] (port=46177 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1NUC3n-0006Je-Jz
	for bug-gnu-emacs@HIDDEN; Sun, 10 Jan 2010 23:39:23 -0500
Received: from mail2.viabit.com ([65.246.80.16]:48202)
	by monty-python.gnu.org with esmtp (Exim 4.60)
	(envelope-from <michael@HIDDEN>) id 1NUC3n-0004Zw-Dw
	for bug-gnu-emacs@HIDDEN; Sun, 10 Jan 2010 23:39:23 -0500
Received: from [192.168.1.100] (c-68-49-223-78.hsd1.md.comcast.net
	[68.49.223.78])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mail2.viabit.com (Postfix) with ESMTPSA id BA04AD8E05
	for <bug-gnu-emacs@HIDDEN>; Sun, 10 Jan 2010 23:39:20 -0500 (EST)
Message-ID: <4B4AAB78.7030102@HIDDEN>
Date: Sun, 10 Jan 2010 23:39:20 -0500
From: Michael Orlitzky <michael@HIDDEN>
User-Agent: Thunderbird 2.0.0.23 (X11/20091004)
MIME-Version: 1.0
To: bug-gnu-emacs@HIDDEN
Subject: diff-jump-to-old-file inverts hunk application as well
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2)
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6,
	seldom 2.4 (older, 4)
X-Spam-Score: -5.9 (-----)
X-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Mon, 11 Jan 2010 01:33:02 -0500
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/pipermail/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -5.9 (-----)

The custom diff-jump-to-old-file causes a reversal of the traditional
diff/patch behavior present in Emacs <= 22. From diff-mode.el, it seems
sort of intentional that this is the case; nevertheless, the new
behavior does not strike me as useful. From diff-mode.el:

(defun diff-apply-hunk (&optional reverse)
   "Apply the current hunk to the source file and go to the next.
   By default, the new source file is patched, but if the variable
   `diff-jump-to-old-file' is non-nil, then the old source file is
   patched instead (some commands, such as `diff-goto-source' can change
   the value of this variable when given an appropriate prefix argument).

Why should the default be to patch the new file, which is by definition
already patched? Take for example,

   gantu ~ $ cat new.txt
   Line 1
   Line 2
   Line 3
   Line 4
   gantu ~ $ cat source.txt
   Line 1
   Line 2
   Line 4
   gantu ~ $ diff -c source.txt new.txt > test.patch
   gantu ~ $ emacs -nw test.patch

(The diff -c accomplishes the same thing as M-x diff would within
Emacs). In this case, when the patch is opened, it is expected that M-x
diff-apply-hunk will patch the source (old) file to the new. That is, it
should add "Line 3" to the third line of the source file. This is how
Emacs <= 22 worked.

With v23, the new behavior is that M-x diff-apply-hunk will attempt to
apply the hunk to new.txt which, of course, already contains that line.
Even if one performs the diff within Emacs and explicitly chooses the
source/new files, the default behavior is to attempt to re-patch the new
file.







Acknowledgement sent to Michael Orlitzky <michael@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs@HIDDEN:
bug#5352; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Fri, 31 Oct 2014 17:00:04 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.