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#70820: [PATCH] Editable grep buffers Date: Tue, 07 May 2024 21:08:37 +0300 Message-ID: <86pltxa40q.fsf@gnu.org> References: <87seytlhcq.fsf@gmail.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="27932"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 70820@debbugs.gnu.org To: Visuwesh Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue May 07 20:10:03 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 1s4PGN-00070w-KV for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 07 May 2024 20:10:03 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s4PG1-0007ri-32; Tue, 07 May 2024 14:09:41 -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 1s4PFx-0007pY-S1 for bug-gnu-emacs@gnu.org; Tue, 07 May 2024 14:09: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 1s4PFx-0001En-JB for bug-gnu-emacs@gnu.org; Tue, 07 May 2024 14:09:37 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1s4PGM-0007Fr-6U for bug-gnu-emacs@gnu.org; Tue, 07 May 2024 14:10: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: Tue, 07 May 2024 18:10:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 70820 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 70820-submit@debbugs.gnu.org id=B70820.171510537327875 (code B ref 70820); Tue, 07 May 2024 18:10:02 +0000 Original-Received: (at 70820) by debbugs.gnu.org; 7 May 2024 18:09:33 +0000 Original-Received: from localhost ([127.0.0.1]:43939 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s4PFs-0007FX-SP for submit@debbugs.gnu.org; Tue, 07 May 2024 14:09:33 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:59894) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s4PFo-0007FR-Bs for 70820@debbugs.gnu.org; Tue, 07 May 2024 14:09:30 -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 1s4PFJ-0000Ls-Qj; Tue, 07 May 2024 14:08:57 -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=3PpZBK226scGsm6ox04YgOtaBrvG/uZXNRqFsVpAA+I=; b=Q1xcuPxxLeFE tW0jmoBhYLG5OsMh2HRcyULM2b8D3XQj9yf31rY52USw/Ey/B8Rb5/kOgaCZriaUlHpOK+GvNCVrQ 44shs9rNLu1CqCT1YF9capapz44mjuvx9jzvqo1gKU91d99mw5D6V2tvF9WvrOfjHwKHSw6GgBHS1 7xm87RidiP9OdplcMMPBVuT77w6LlwIAGceO1nvhdrhdFdAuJ+w6wdmuyxOGQg5C2nNLUT1Bwy7rt KmiLdFlon+Tyv9VXNiF6A911ASlRula0aanLYQEG7K+xA+Rqr5tGggPq5+TRyccP2LMvvSzJViasw 8RLIGFTsWvdkxYZEEWmtrw==; In-Reply-To: <87seytlhcq.fsf@gmail.com> (message from Visuwesh on Tue, 07 May 2024 21:55:09 +0530) 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:284651 Archived-At: > From: Visuwesh > Date: Tue, 07 May 2024 21:55:09 +0530 > > Attached patch is a proof of concept for an occur-edit-mode alike for > *grep* buffers. It uses the new track-changes library to track the > edits made in the *grep* buffer to then finally save these edits to the > corresponding files. I've tested this with: > > 1. pure deletions: If you have a match that says "(cur-beg start" > and you change it to "(cur- start". This is special because > track-changes-fetch passes equal BEG and END to > grep-edit--track-changes-finalise. > 2. edits: something like "(cur-beg start" -> "(cur-beg start balh" > is handled like you would expect. > 3. edits with newline: if the edit includes a newline, then that is > reproduced. > > and what is not handled currently: deleting a match line to imply > deletion of that line from the matched file. I don't know how to handle > this currently, I need to learn the library more. > > There's also definitely a million more cases that I didn't anticipate > when I wrote the logic for grep-edit--track-changes-finalise. > > I'm sending the patch now to see if there's enough interest before I go > about fixing the edge cases (there's bug#52815). If there is enough > interest, I will take a shot at implementing something like this for > xref result buffers too. Thanks for working on this. I wonder if this could be somehow either based on or at least have the same look-and-feel as occur-edit-mode, which provides a very similar feature in *occur* buffers.