GNU bug report logs - #52815
Editable grep buffer

Previous Next

Package: emacs;

Reported by: ndame <laszlomail <at> protonmail.com>

Date: Mon, 27 Dec 2021 10:04:02 UTC

Severity: wishlist

To reply to this bug, email your comments to 52815 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#52815; Package emacs. (Mon, 27 Dec 2021 10:04:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to ndame <laszlomail <at> protonmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 27 Dec 2021 10:04:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: ndame <laszlomail <at> protonmail.com>
To: "Bug reports for GNU Emacs,
 the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
Subject: Editable grep buffer
Date: Mon, 27 Dec 2021 10:02:50 +0000
[Message part 1 (text/plain, inline)]
Commands which produce a *grep* buffer (grep, grep-find) should allow the user to edit the results and apply them to the original locations like Occur does.

There is the external package wgrep, but if Occur provides this, then the user logically expects that the similar *grep* results can also be edited in place out of the box.

https://github.com/mhayashi1120/Emacs-wgrep
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#52815; Package emacs. (Mon, 27 Dec 2021 15:10:02 GMT) Full text and rfc822 format available.

Message #8 received at 52815 <at> debbugs.gnu.org (full text, mbox):

From: Daniel Martín <mardani29 <at> yahoo.es>
To: ndame via "Bug reports for GNU Emacs, the Swiss army knife of text
 editors" <bug-gnu-emacs <at> gnu.org>
Cc: ndame <laszlomail <at> protonmail.com>, 52815 <at> debbugs.gnu.org
Subject: Re: bug#52815: Editable grep buffer
Date: Mon, 27 Dec 2021 16:09:48 +0100
ndame via "Bug reports for GNU Emacs, the Swiss army knife of text
editors" <bug-gnu-emacs <at> gnu.org> writes:

> Commands which produce a *grep* buffer (grep, grep-find) should allow the user to edit the results and apply them to the original locations like Occur does.
>
> There is the external package wgrep, but if Occur provides this, then the user logically expects that the similar *grep* results can also be edited in place out of the box.
>
> https://github.com/mhayashi1120/Emacs-wgrep

+1.  Emacs offers similar functionality for dired (wdired), which is
very popular.

This writable buffer package could also work on *xref* buffers.  I think
that the new package should be designed in a way where it delegates part
of its work to some "adapters" that convert between the buffer's
contents and the *grep* buffer's contents (which are stable over time).




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#52815; Package emacs. (Mon, 27 Dec 2021 15:11:01 GMT) Full text and rfc822 format available.

Severity set to 'wishlist' from 'normal' Request was from Stefan Kangas <stefan <at> marxist.se> to control <at> debbugs.gnu.org. (Mon, 27 Dec 2021 15:25:04 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#52815; Package emacs. (Wed, 29 Dec 2021 00:30:02 GMT) Full text and rfc822 format available.

Message #16 received at 52815 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefan <at> marxist.se>
To: ndame <laszlomail <at> protonmail.com>
Cc: 52815 <at> debbugs.gnu.org
Subject: Re: bug#52815: Editable grep buffer
Date: Tue, 28 Dec 2021 16:29:20 -0800
ndame <laszlomail <at> protonmail.com> writes:

> Commands which produce a *grep* buffer (grep, grep-find) should allow
> the user to edit the results and apply them to the original locations
> like Occur does.
>
> There is the external package wgrep, but if Occur provides this, then
> the user logically expects that the similar *grep* results can also be
> edited in place out of the box.
>
> https://github.com/mhayashi1120/Emacs-wgrep

Agreed.

I think the best way to make any progress here is to acquire the
necessary copyright assigments for wgrep.el.  Then we could just include
that in core.

The alternative is to rewrite wgrep.el.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#52815; Package emacs. (Wed, 29 Dec 2021 06:32:02 GMT) Full text and rfc822 format available.

Message #19 received at 52815 <at> debbugs.gnu.org (full text, mbox):

From: ndame <laszlomail <at> protonmail.com>
To: Stefan Kangas <stefan <at> marxist.se>
Cc: 52815 <at> debbugs.gnu.org
Subject: Re: bug#52815: Editable grep buffer
Date: Wed, 29 Dec 2021 06:31:48 +0000
> The alternative is to rewrite wgrep.el.

Haven't checked the code in occur, but  if propagating the
changes back to the original location is implemented there,
then I'd think the same code would work for grep too by adding
switching to the relevant file before applying the changes.

Maybe that code could be extracted and emacs could have a generic
mechanism for showing lines from other files in a buffer and
propagating changes there back to the original location.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#52815; Package emacs. (Wed, 29 Dec 2021 16:02:01 GMT) Full text and rfc822 format available.

Message #22 received at 52815 <at> debbugs.gnu.org (full text, mbox):

From: Richard Stallman <rms <at> gnu.org>
To: Stefan Kangas <stefan <at> marxist.se>
Cc: laszlomail <at> protonmail.com, 52815 <at> debbugs.gnu.org
Subject: Re: bug#52815: Editable grep buffer
Date: Wed, 29 Dec 2021 11:01:37 -0500
[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

  > > Commands which produce a *grep* buffer (grep, grep-find) should allow
  > > the user to edit the results and apply them to the original locations
  > > like Occur does.

I can see two meanings for "the original locations" -- does it mean
the locations stated in the edited grep output, or does it mean the locations
that _were_ stated in the original grep output (before editing it)?

If it is the former, then can't you do this with C-u C-x ` ?
I just tried it and it worked.  C-u C-x ` reparses the error locations
in the buffer.

Actually editing the text in the Grep mode buffer is a nuisance, since
many self-inserting characters do unusual things.  But that is a
different issue.

-- 
Dr Richard Stallman (https://stallman.org)
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)






Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#52815; Package emacs. (Wed, 29 Dec 2021 20:53:01 GMT) Full text and rfc822 format available.

Message #25 received at 52815 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefan <at> marxist.se>
To: rms <at> gnu.org
Cc: laszlomail <at> protonmail.com, 52815 <at> debbugs.gnu.org
Subject: Re: bug#52815: Editable grep buffer
Date: Wed, 29 Dec 2021 12:51:59 -0800
Richard Stallman <rms <at> gnu.org> writes:

> I can see two meanings for "the original locations" -- does it mean
> the locations stated in the edited grep output, or does it mean the locations
> that _were_ stated in the original grep output (before editing it)?
>
> If it is the former, then can't you do this with C-u C-x ` ?
> I just tried it and it worked.  C-u C-x ` reparses the error locations
> in the buffer.

This is not what wgrep.el does, so this bug report is not about that.

> Actually editing the text in the Grep mode buffer is a nuisance, since
> many self-inserting characters do unusual things.  But that is a
> different issue.

This is the issue we are discussing here, as that is what wgrep does.
It works well in practice, analogous to how wdired works but it edits
multiple files.  You enter wgrep-mode from grep-mode to make your edits
with `C-x C-q', edit the text of the buffer and then type `C-x C-s' to
save your changes to the relevant files.

This is very similar to wdired.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#52815; Package emacs. (Fri, 31 Dec 2021 04:25:01 GMT) Full text and rfc822 format available.

Message #28 received at 52815 <at> debbugs.gnu.org (full text, mbox):

From: Richard Stallman <rms <at> gnu.org>
To: Stefan Kangas <stefan <at> marxist.se>
Cc: laszlomail <at> protonmail.com, 52815 <at> debbugs.gnu.org
Subject: Re: bug#52815: Editable grep buffer
Date: Thu, 30 Dec 2021 23:24:35 -0500
[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

  > > Actually editing the text in the Grep mode buffer is a nuisance, since
  > > many self-inserting characters do unusual things.  But that is a
  > > different issue.

  > This is the issue we are discussing here, as that is what wgrep does.
  > It works well in practice, analogous to how wdired works but it edits
  > multiple files.  You enter wgrep-mode from grep-mode to make your edits
  > with `C-x C-q', edit the text of the buffer and then type `C-x C-s' to
  > save your changes to the relevant files.

That makes sense.  The original message didn't describe it clearly.

-- 
Dr Richard Stallman (https://stallman.org)
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)






This bug report was last modified 3 years and 167 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.