From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#62731: 29.0.60; diff-apply-hunk doesn't work for creating new files Date: Sat, 19 Oct 2024 21:11:05 +0300 Organization: LINKOV.NET Message-ID: <86y12k55fq.fsf@mail.linkov.net> References: <5afef01c-a8a8-485c-aa12-0b19e5bf21ba@gutov.dev> <87jzyln9g0.fsf@catern.com> <865xpt739v.fsf_-_@mail.linkov.net> <1cc9143d-96c2-47d8-afaa-70c4e766a953@gutov.dev> <86ttdazk89.fsf@mail.linkov.net> <213a855a-4e27-4d15-828a-cadc97f25119@gutov.dev> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="38834"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50 (x86_64-pc-linux-gnu) Cc: sbaugh@catern.com, 62731@debbugs.gnu.org To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Oct 19 20:21:53 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1t2E5I-0009xh-U4 for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 19 Oct 2024 20:21:53 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t2E58-0002Us-0R; Sat, 19 Oct 2024 14:21:42 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t2E55-0002Q5-0O for bug-gnu-emacs@gnu.org; Sat, 19 Oct 2024 14:21:39 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t2E53-000804-Qi for bug-gnu-emacs@gnu.org; Sat, 19 Oct 2024 14:21:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=PkuaW66PlpcAHc+XqWFn+OIq/FcHn6uqBKB636PxOsE=; b=kWv/i2iwEkBCTxncaFhvRic/6hpxPr8hPAUV0iKSKDtwjFmp+wbVkGl9mhZa+h7j4PxMoq3ktM/beL+u+CS9ELp1+LVC02HIHkKjvK/DnlFx8HIdf362BJn4YDQ6BFNW6K60er3kj06GUUEAMezpU2IxeM1ka4ucgh7oCuRVMS4+fTKwdl581IxHjA7K49M3mOh0s0mUSIcee3fK9JwA3CzdVTt88FJ10fcRHr0IcA0v7gpjkHROwncqyMpmt9UdP3tW8VEAZH5ZsrT60EqBGnAZIVlXysNRe7+eF994PIMjaMfrv6S4eEnSkDIw9b1pQ5R6lkLZ8OUtzkwaVL88Ew==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1t2E5R-0005Et-PQ for bug-gnu-emacs@gnu.org; Sat, 19 Oct 2024 14:22:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 19 Oct 2024 18:22:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62731 X-GNU-PR-Package: emacs Original-Received: via spool by 62731-submit@debbugs.gnu.org id=B62731.172936211920130 (code B ref 62731); Sat, 19 Oct 2024 18:22:01 +0000 Original-Received: (at 62731) by debbugs.gnu.org; 19 Oct 2024 18:21:59 +0000 Original-Received: from localhost ([127.0.0.1]:44757 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t2E5P-0005Eb-IQ for submit@debbugs.gnu.org; Sat, 19 Oct 2024 14:21:59 -0400 Original-Received: from relay7-d.mail.gandi.net ([217.70.183.200]:48207) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t2E5N-0005EL-Bi for 62731@debbugs.gnu.org; Sat, 19 Oct 2024 14:21:58 -0400 Original-Received: by mail.gandi.net (Postfix) with ESMTPSA id 9B9BE20002; Sat, 19 Oct 2024 18:21:03 +0000 (UTC) In-Reply-To: <213a855a-4e27-4d15-828a-cadc97f25119@gutov.dev> (Dmitry Gutov's message of "Sat, 19 Oct 2024 02:29:51 +0100") X-GND-Sasl: juri@linkov.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:293906 Archived-At: >>> Otherwise, I don't quite understand the intent behind that line. But it >>> might have been masking the problem which I (hopefully) fixed in the >>> hunk you quoted/ >> There is already one 'xor' here. Maybe the second 'xor' not needed: >> (defun diff-find-source-location (&optional other-file reverse noprompt) >> ... >> (let* ((other (xor other-file diff-jump-to-old-file)) >> ... >> (file (or (diff-find-file-name (xor other reverse) noprompt) > > Yes ok, let's try moving that to the caller. Pushed as commit > 1374f20491b. A few other callers use non-nil 'reverse', but I suppose > diff-test-hunk is not very useful for file creation/deletion. Thanks for fixing, I confirm that now 'C-c C-c' doesn't go to the backup file, only 'C-u C-c C-c' does. > Note that the new (same as previous) behavior is to always visit the source > buffer, newer the backup file's buffer. I hope that is the goal. I forgot that diff-goto-source is not context-dependent for file diffs, unlike for vc-diff. So for file diffs it depends only on the prefix arg. I don't know why is such inconsistency and whether it should be improved.