unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#52815: Editable grep buffer
@ 2021-12-27 10:02 ndame via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-12-27 15:09 ` Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-12-29  0:29 ` Stefan Kangas
  0 siblings, 2 replies; 7+ messages in thread
From: ndame via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2021-12-27 10:02 UTC (permalink / raw)
  To: 52815

[-- Attachment #1: Type: text/plain, Size: 375 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 479 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#52815: Editable grep buffer
  2021-12-27 10:02 bug#52815: Editable grep buffer ndame via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2021-12-27 15:09 ` Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-12-29  0:29 ` Stefan Kangas
  1 sibling, 0 replies; 7+ messages in thread
From: Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2021-12-27 15:09 UTC (permalink / raw)
  To: 52815; +Cc: laszlomail

ndame via "Bug reports for GNU Emacs, the Swiss army knife of text
editors" <bug-gnu-emacs@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).





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#52815: Editable grep buffer
  2021-12-27 10:02 bug#52815: Editable grep buffer ndame via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-12-27 15:09 ` Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2021-12-29  0:29 ` Stefan Kangas
  2021-12-29  6:31   ` ndame via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-12-29 16:01   ` Richard Stallman
  1 sibling, 2 replies; 7+ messages in thread
From: Stefan Kangas @ 2021-12-29  0:29 UTC (permalink / raw)
  To: ndame; +Cc: 52815

ndame <laszlomail@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.





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#52815: Editable grep buffer
  2021-12-29  0:29 ` Stefan Kangas
@ 2021-12-29  6:31   ` ndame via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-12-29 16:01   ` Richard Stallman
  1 sibling, 0 replies; 7+ messages in thread
From: ndame via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2021-12-29  6:31 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: 52815


> 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.





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#52815: Editable grep buffer
  2021-12-29  0:29 ` Stefan Kangas
  2021-12-29  6:31   ` ndame via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2021-12-29 16:01   ` Richard Stallman
  2021-12-29 20:51     ` Stefan Kangas
  1 sibling, 1 reply; 7+ messages in thread
From: Richard Stallman @ 2021-12-29 16:01 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: laszlomail, 52815

[[[ 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)







^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#52815: Editable grep buffer
  2021-12-29 16:01   ` Richard Stallman
@ 2021-12-29 20:51     ` Stefan Kangas
  2021-12-31  4:24       ` Richard Stallman
  0 siblings, 1 reply; 7+ messages in thread
From: Stefan Kangas @ 2021-12-29 20:51 UTC (permalink / raw)
  To: rms; +Cc: laszlomail, 52815

Richard Stallman <rms@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.





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#52815: Editable grep buffer
  2021-12-29 20:51     ` Stefan Kangas
@ 2021-12-31  4:24       ` Richard Stallman
  0 siblings, 0 replies; 7+ messages in thread
From: Richard Stallman @ 2021-12-31  4:24 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: laszlomail, 52815

[[[ 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)







^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-12-31  4:24 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-27 10:02 bug#52815: Editable grep buffer ndame via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-12-27 15:09 ` Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-12-29  0:29 ` Stefan Kangas
2021-12-29  6:31   ` ndame via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-12-29 16:01   ` Richard Stallman
2021-12-29 20:51     ` Stefan Kangas
2021-12-31  4:24       ` Richard Stallman

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).