From unknown Sun Jun 15 08:40:19 2025 X-Loop: bug-gnu-emacs@gnu.org Subject: bug#5352: diff-jump-to-old-file inverts hunk application as well Reply-To: Michael Orlitzky , 5352@debbugs.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: Received: via spool by submit@debbugs.gnu.org id=B.126319158428505 (code B ref -1); Mon, 11 Jan 2010 06:34:01 +0000 Received: (at submit) by debbugs.gnu.org; 11 Jan 2010 06:33:04 +0000 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 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 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 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 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 ) id 1NUC3s-0004a6-Pq for submit@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@gnu.org; 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@gnu.org; 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@gnu.org; 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 ) id 1NUC3n-0004Zw-Dw for bug-gnu-emacs@gnu.org; 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 ; Sun, 10 Jan 2010 23:39:20 -0500 (EST) Message-ID: <4B4AAB78.7030102@orlitzky.com> Date: Sun, 10 Jan 2010 23:39:20 -0500 From: Michael Orlitzky User-Agent: Thunderbird 2.0.0.23 (X11/20091004) MIME-Version: 1.0 To: bug-gnu-emacs@gnu.org 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-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 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@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. From unknown Sun Jun 15 08:40:19 2025 X-Loop: help-debbugs@gnu.org Subject: bug#5352: diff-jump-to-old-file inverts hunk application as well Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 09 May 2022 14:33:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 5352 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Michael Orlitzky Cc: 5352@debbugs.gnu.org Received: via spool by 5352-submit@debbugs.gnu.org id=B5352.165210675131470 (code B ref 5352); Mon, 09 May 2022 14:33:02 +0000 Received: (at 5352) by debbugs.gnu.org; 9 May 2022 14:32:31 +0000 Received: from localhost ([127.0.0.1]:59053 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1no4R5-0008BC-05 for submit@debbugs.gnu.org; Mon, 09 May 2022 10:32:31 -0400 Received: from quimby.gnus.org ([95.216.78.240]:42882) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1no4Qw-0007za-I5 for 5352@debbugs.gnu.org; Mon, 09 May 2022 10:32:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=LeVioaotoAfgmDE9Ry1wHAhNagG2wJ3IO63OP3FyoAA=; b=Zc10nu1dUud7yZMY9A7vkSbJp4 L3ewFGVYz3ADePTO0B1ESXrxZucerqg2qaHrNbkNZ62kE0K4bsOwLQR/htJv4XCZzUhNHZ9PZ5F56 VJonuer+fshnSmD0y4SOb21x6SmkfhtJLk+HbS3EGlBLlgTLjQkANk+P+gMDgKL6o8AI=; Received: from [84.212.220.105] (helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1no4Qm-0006on-Ce; Mon, 09 May 2022 16:32:14 +0200 From: Lars Ingebrigtsen References: <4B4AAB78.7030102@orlitzky.com> X-Now-Playing: King Crimson's _Beat_: "Waiting Man" Date: Mon, 09 May 2022 16:32:11 +0200 In-Reply-To: <4B4AAB78.7030102@orlitzky.com> (Michael Orlitzky's message of "Sun, 10 Jan 2010 23:39:20 -0500") Message-ID: <875yme6al0.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Michael Orlitzky writes: > 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; neverthel [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Michael Orlitzky writes: > 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, (I'm going through old bug reports that unfortunately weren't resolved at the time.) I think the logic here is when you have a diff that's been partially applied, so that the "new" file isn't literally the one you've already applied the patch to. In that case, you usually want to apply the hunk to the new file, and not the old one. In any case, the current behaviour has been in place for a decade, so I think it's too late to change it now (because that would break things for people that's used to the direction it works in now). So I'm closing this bug report. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Mon May 09 10:32:28 2022 Received: (at control) by debbugs.gnu.org; 9 May 2022 14:32:28 +0000 Received: from localhost ([127.0.0.1]:59051 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1no4R1-00088U-Np for submit@debbugs.gnu.org; Mon, 09 May 2022 10:32:27 -0400 Received: from quimby.gnus.org ([95.216.78.240]:42896) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1no4R0-00083G-KZ for control@debbugs.gnu.org; Mon, 09 May 2022 10:32:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Subject:From:To:Message-Id:Date:Sender:Reply-To:Cc: MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=he0jgxFrmmP2i2K8BtstLXgvdBnqB/fwU5COFnbMp+g=; b=hEhXqgeffVUYgvvzHNPwotlQV2 yzaXDJ4Xjc8vcJMKA9fT4V6eZYF1TSIDUX30pdDNi0cWhnAkKkC97/mhUp2KThxs2+YGoDZxj10vr 0pUtH8Z8SUi2pmRnaSbF0MzJXm3++VVhijqE2DlwRRXOnf357hM/VxgTJ/7yF2fZERQo=; Received: from [84.212.220.105] (helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1no4Qs-0006ou-Rg for control@debbugs.gnu.org; Mon, 09 May 2022 16:32:20 +0200 Date: Mon, 09 May 2022 16:32:18 +0200 Message-Id: <874k1y6akt.fsf@gnus.org> To: control@debbugs.gnu.org From: Lars Ingebrigtsen Subject: control message for bug #5352 X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: close 5352 quit Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) close 5352 quit From unknown Sun Jun 15 08:40:19 2025 X-Loop: help-debbugs@gnu.org Subject: bug#5352: diff-jump-to-old-file inverts hunk application as well Resent-From: Michael Orlitzky Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 09 May 2022 16:19:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 5352 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Lars Ingebrigtsen Cc: 5352@debbugs.gnu.org Received: via spool by 5352-submit@debbugs.gnu.org id=B5352.165211309229129 (code B ref 5352); Mon, 09 May 2022 16:19:01 +0000 Received: (at 5352) by debbugs.gnu.org; 9 May 2022 16:18:12 +0000 Received: from localhost ([127.0.0.1]:59262 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1no65M-0007Zl-CT for submit@debbugs.gnu.org; Mon, 09 May 2022 12:18:12 -0400 Received: from mail2.viabit.com ([65.246.80.16]:46556) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1no65K-0007ZU-Pd for 5352@debbugs.gnu.org; Mon, 09 May 2022 12:18:11 -0400 Received: from [172.17.29.3] (vpn1.metro-data.com [65.213.236.242]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail2.viabit.com (Postfix) with ESMTPSA id 4KxmYT0blkz45WL; Mon, 9 May 2022 12:18:05 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=orlitzky.com; s=mail2; t=1652113085; bh=4vxpNxTok3Lh/IoJcqPazmL9YYHtL5YD/uE0A2h/R3I=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=kQFgnkQxOSJZOcz1C5shxcthshWAc/oFSCnEQnRpmSpzbD4qXA3gSbbpVbr0iGXPV n+1DC9p19d7pamDq0l2YK0L6ltyWKL6CRtWfi6VQOL2d2ydN0JrKPMMo2M6IT5WSLF O7hlP4QoJCbbAR1agXR2KjiQ+uTc2hcfnshIOm2Y= Message-ID: <270d1db84f319b17450d63a3c244824f3c28f579.camel@orlitzky.com> From: Michael Orlitzky Date: Mon, 09 May 2022 12:18:04 -0400 In-Reply-To: <875yme6al0.fsf@gnus.org> References: <4B4AAB78.7030102@orlitzky.com> <875yme6al0.fsf@gnus.org> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.42.4 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) On Mon, 2022-05-09 at 16:32 +0200, Lars Ingebrigtsen wrote: > > So I'm closing this bug report. > This seems to be working like I expect it to now, so maybe the issue was elsewhere and has been fixed in the meantime.