From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#65854: Multi-file replacement diff Date: Mon, 11 Sep 2023 15:35:47 +0300 Message-ID: <83jzswrios.fsf@gnu.org> References: <86sf7mgd54.fsf@mail.linkov.net> <86bke943tp.fsf@mail.linkov.net> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="25973"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 65854@debbugs.gnu.org, juri@linkov.net To: Eshel Yaron Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Sep 11 14:37:15 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 1qfgAF-0006ZF-6s for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 11 Sep 2023 14:37:15 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qfgA2-0008GM-Nl; Mon, 11 Sep 2023 08:37:02 -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 1qfg9z-00088S-K3 for bug-gnu-emacs@gnu.org; Mon, 11 Sep 2023 08:37:00 -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 1qfg9z-00048b-AV for bug-gnu-emacs@gnu.org; Mon, 11 Sep 2023 08:36:59 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qfgA2-0003Rl-9i for bug-gnu-emacs@gnu.org; Mon, 11 Sep 2023 08:37:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 11 Sep 2023 12:37:02 +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.169443577713180 (code B ref 65854); Mon, 11 Sep 2023 12:37:02 +0000 Original-Received: (at 65854) by debbugs.gnu.org; 11 Sep 2023 12:36:17 +0000 Original-Received: from localhost ([127.0.0.1]:52304 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qfg9I-0003QV-OS for submit@debbugs.gnu.org; Mon, 11 Sep 2023 08:36:17 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:59312) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qfg9G-0003QG-Os for 65854@debbugs.gnu.org; Mon, 11 Sep 2023 08:36:16 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qfg96-00044C-9M; Mon, 11 Sep 2023 08:36:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=SMpcmKLjbJzv16dCwUtiH428P/PhrWfP0ENyBkGZG1M=; b=LMZe2jeDCjTz doQ3UmyaDHSrn/5CwktfUVDraOCp1FJb8ZJM1f7g7TdD6Omd0aNxWCI9/M8GGQkTTlCGc6q3dDDnh HJtTFy9kkT81xK6NyvLBzvugvIPzf06QcPQOXbk1rTm9eT1F71jjlxtcCDZcLwA5XwvOgl8lSgWLj ERgutnOBeYbN9KFMyjIvAzpz/MJhK+wyFKiokH8EBdjT2LbNBpwMfNWunzsIbbpqg3k+ECFV3ZByl cID9nov2/PAB5woJEzazf7X0ODzuwdGr7V9TpdLTZdNIXkNy543+nmmuFC99cYDfuOiuEdyTy00yu iMZhvtqB/MQjCX9tqCxirQ==; In-Reply-To: (bug-gnu-emacs@gnu.org) 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:270039 Archived-At: > Cc: 65854@debbugs.gnu.org > Date: Mon, 11 Sep 2023 09:23:37 +0200 > From: Eshel Yaron via "Bug reports for GNU Emacs, > the Swiss army knife of text editors" > > >> I wonder what happens if I call `multi-file-replace-regexp-as-diff` and > >> select a file `foo.txt`, that I already have open and modified in a > >> buffer. IIUC, this will generate the diff based on the contents of the > >> file on disk, not the buffer, so it might not match when I subsequently > >> try to apply the diff to the buffer. WDYT? > > > > For such cases you can use multi-buffer-replace-regexp-as-diff > > from this patch instead of multi-file-replace-regexp-as-diff. > > 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.