From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Michael Orlitzky Newsgroups: gmane.emacs.bugs Subject: bug#5352: diff-jump-to-old-file inverts hunk application as well Date: Sun, 10 Jan 2010 23:39:20 -0500 Message-ID: <4B4AAB78.7030102@orlitzky.com> Reply-To: Michael Orlitzky , 5352@debbugs.gnu.org NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1263259461 20652 80.91.229.12 (12 Jan 2010 01:24:21 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 12 Jan 2010 01:24:21 +0000 (UTC) To: bug-gnu-emacs@gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Jan 12 02:24:13 2010 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 1NUVUP-0003CD-Ae for geb-bug-gnu-emacs@m.gmane.org; Tue, 12 Jan 2010 02:24:09 +0100 Original-Received: from localhost ([127.0.0.1]:40127 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NUVUP-00064A-NG for geb-bug-gnu-emacs@m.gmane.org; Mon, 11 Jan 2010 20:24:09 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NUE5P-0007dp-KB for bug-gnu-emacs@gnu.org; Mon, 11 Jan 2010 01:49:11 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NUE5K-0007dH-Ch for bug-gnu-emacs@gnu.org; Mon, 11 Jan 2010 01:49:10 -0500 Original-Received: from [199.232.76.173] (port=46476 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NUE5K-0007dE-1k for bug-gnu-emacs@gnu.org; Mon, 11 Jan 2010 01:49:06 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:51928) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NUE5J-0001az-NU for bug-gnu-emacs@gnu.org; Mon, 11 Jan 2010 01:49:05 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1NUDqj-0007QC-Nv; Mon, 11 Jan 2010 01:34:01 -0500 X-Loop: bug-gnu-emacs@gnu.org Mail-Followup-To: Michael Orlitzky , 5352@debbugs.gnu.org Resent-From: Michael Orlitzky Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 11 Jan 2010 06:34:01 +0000 Resent-Message-ID: Resent-Sender: bug-gnu-emacs@gnu.org X-Emacs-PR-Message: report 5352 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Original-Received: via spool by submit@debbugs.gnu.org id=B.126319158428505 (code B ref -1); Mon, 11 Jan 2010 06:34:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 11 Jan 2010 06:33:04 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NUDpn-0007Pi-Iv for submit@debbugs.gnu.org; Mon, 11 Jan 2010 01:33:03 -0500 Original-Received: from fencepost.gnu.org ([140.186.70.10]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NUC3x-0006Bh-Cz for submit@debbugs.gnu.org; Sun, 10 Jan 2010 23:39:34 -0500 Original-Received: from mx10.gnu.org ([199.232.76.166]:36535) by fencepost.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NUC3u-0004jC-0y for submit@debbugs.gnu.org; Sun, 10 Jan 2010 23:39:30 -0500 Original-Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1NUC3s-0004aC-V9 for submit@debbugs.gnu.org; Sun, 10 Jan 2010 23:39:29 -0500 Original-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 ) id 1NUC3s-0004a6-Pq for submit@debbugs.gnu.org; Sun, 10 Jan 2010 23:39:28 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NUC3s-0006PN-DS for bug-gnu-emacs@gnu.org; Sun, 10 Jan 2010 23:39:28 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NUC3n-0006Jj-Mw for bug-gnu-emacs@gnu.org; Sun, 10 Jan 2010 23:39:28 -0500 Original-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@gnu.org; Sun, 10 Jan 2010 23:39:23 -0500 Original-Received: from mail2.viabit.com ([65.246.80.16]:48202) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NUC3n-0004Zw-Dw for bug-gnu-emacs@gnu.org; Sun, 10 Jan 2010 23:39:23 -0500 Original-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 ; Sun, 10 Jan 2010 23:39:20 -0500 (EST) User-Agent: Thunderbird 2.0.0.23 (X11/20091004) 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-Mailman-Approved-At: Mon, 11 Jan 2010 01:33:02 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list X-Spam-Score: -5.9 (-----) Resent-Date: Mon, 11 Jan 2010 01:34:01 -0500 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) X-Mailman-Approved-At: Mon, 11 Jan 2010 20:24:01 -0500 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: , 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:34211 Archived-At: 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.