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#65854: Multi-file replacement diff Date: Tue, 12 Sep 2023 09:52:42 +0300 Organization: LINKOV.NET Message-ID: <86o7i7oo9t.fsf@mail.linkov.net> References: <86sf7mgd54.fsf@mail.linkov.net> <86bke943tp.fsf@mail.linkov.net> <83jzswrios.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13211"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu) Cc: Eshel Yaron , 65854@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Sep 12 09:33:16 2023 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 1qfxtc-0003Ee-1g for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 12 Sep 2023 09:33:16 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qfxtL-0001OB-6h; Tue, 12 Sep 2023 03:32:59 -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 1qfxtJ-0001O3-HG for bug-gnu-emacs@gnu.org; Tue, 12 Sep 2023 03:32:57 -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 1qfxtJ-0006iu-4p for bug-gnu-emacs@gnu.org; Tue, 12 Sep 2023 03:32:57 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qfxtN-0006Ze-Jk for bug-gnu-emacs@gnu.org; Tue, 12 Sep 2023 03:33: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: Tue, 12 Sep 2023 07:33:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 65854 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 65854-submit@debbugs.gnu.org id=B65854.169450393125209 (code B ref 65854); Tue, 12 Sep 2023 07:33:01 +0000 Original-Received: (at 65854) by debbugs.gnu.org; 12 Sep 2023 07:32:11 +0000 Original-Received: from localhost ([127.0.0.1]:55972 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qfxsZ-0006YW-Cy for submit@debbugs.gnu.org; Tue, 12 Sep 2023 03:32:11 -0400 Original-Received: from relay5-d.mail.gandi.net ([2001:4b98:dc4:8::225]:53721) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qfxsX-0006YI-Je for 65854@debbugs.gnu.org; Tue, 12 Sep 2023 03:32:10 -0400 Original-Received: by mail.gandi.net (Postfix) with ESMTPSA id D98811C0030; Tue, 12 Sep 2023 07:30:32 +0000 (UTC) In-Reply-To: <83jzswrios.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 11 Sep 2023 15:35:47 +0300") 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:270143 Archived-At: >> Well, in the simple example of one file, yes that possible, but the >> point is that you don't always know (or worry about) whether there's an >> overlap between the files you have open and modified and the files your >> regexp/wildcard matches. Let's say I'm editing an HTML file, and find >> something that I'd like to change. So I do it. Than I think "actually, >> let's change that across all my HTML files in this directory". IMO It >> would be great if I could use this new command, >> `multi-file-replace-regexp-as-diff`, to get a diff showing how that'd >> look. But in the proposed implementation, that won't work if one of >> those HTML files is open and modified--without any warning, Emacs would >> create a diff that doesn't apply. > > Our usual paradigm for these commands is to offer saving any buffers > with unsaved edits, before running the main part of the command. I don't know if users will find this too annoying, maybe not, but probably this is what should be done to solve such dilemma that the same diff can be used in two ways: by applying the diff to the buffers with 'C-c C-a', or by applying to the files with 'git apply'. Without saving the buffers before running the command, either will fail: 'C-c C-a' will fail on changes produced from files, 'git apply' will fail on changes produced from unsaved buffers.