From: Jim Porter <jporterbugs@gmail.com>
To: Sean Whitton <spwhitton@spwhitton.name>
Cc: Antero Mejr <antero@mailbox.org>, 62426@debbugs.gnu.org
Subject: bug#62426: [PATCH] eshell: Add 'rgrep' builtin.
Date: Sat, 8 Apr 2023 18:55:06 -0700 [thread overview]
Message-ID: <cd4db410-ab6b-219a-daa0-d885057dd928@gmail.com> (raw)
In-Reply-To: <87355syce8.fsf@athena.silentflame.com>
On 3/25/2023 10:22 AM, Sean Whitton wrote:
> On Fri 24 Mar 2023 at 05:04PM -07, Jim Porter wrote:
>
>> That said, it might be a bit strange for Eshell's rgrep to work this way, when
>> Eshell's agrep/egrep/fgrep work like the external versions. This seems like a
>> tricky case...
>
> Tricky indeed. Here is an attempt:
>
> Normally with M-x rgrep one benefits from how Emacs prompts you
> separately for the parameters to the function, right? In particular,
> you get completion for the second and third parameters. Given that,
> you're unlikely to want to type 'rgrep foo bar baz' into Eshell, and not
> benefit from that completion, when you could just type M-x rgrep in the
> same buffer, and benefit from it.
>
> Given this, I suggest rgrep in Eshell should be /usr/bin/rgrep.
I've dug through the Eshell grep code over the last few days, and after
some thinking, I agree that the initial patch is the right way to go.
While I think it would be nice to get the benefits of M-x rgrep into
Eshell, it's just too much of a deviation from the existing Eshell grep
builtins. For example, M-x grep defaults to using "--color=auto", but
eshell/grep doesn't: eshell/grep is (close to) what you'd get if you
called /usr/bin/grep directly.
It's all a bit strange though since eshell/grep forces you to have the
flags "-nH" (file and line number) so that the compilation buffer works
right. But Eshell sets those flags even when you're *not* using a
compilation buffer (e.g. when piping the output of grep to some other
process). I'm not sure it's the behavior I'd want, but it is the way it
is, and I think it's too late to change it now.
I just see one issue with the patch: the NEWS entry and docstring are a
bit misleading. I know these are just copying from the existing Eshell
functions, but this isn't really accurate: "Use Emacs grep facility
instead of calling external rgrep." It *always* calls the external
rgrep; it's just that sometimes the output goes into a compilation buffer.
Instead, how about something like this? "Call the external rgrep
program, opening its output in a compilation buffer when possible."
(Plus similar changes to the other existing functions.) I think that
makes it clearer what's actually happening.
Anyway, sorry for the back and forth on this. This is a part of Eshell
that I haven't looked at in much detail before, and I wanted to get a
better sense of what our options were here.
next prev parent reply other threads:[~2023-04-09 1:55 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-24 21:02 bug#62426: [PATCH] eshell: Add 'rgrep' builtin Antero Mejr via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-03-25 0:04 ` Jim Porter
2023-03-25 17:22 ` Sean Whitton
2023-03-25 19:07 ` Jim Porter
2023-03-30 21:19 ` Sean Whitton
2023-03-31 0:14 ` Jim Porter
2023-04-09 1:55 ` Jim Porter [this message]
2023-04-11 2:12 ` Antero Mejr via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-04-11 4:01 ` Jim Porter
2023-06-03 1:41 ` bug#62426: (no subject) Antero Mejr via Bug reports for GNU Emacs, the Swiss army knife of text editors
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cd4db410-ab6b-219a-daa0-d885057dd928@gmail.com \
--to=jporterbugs@gmail.com \
--cc=62426@debbugs.gnu.org \
--cc=antero@mailbox.org \
--cc=spwhitton@spwhitton.name \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.