GNU bug report logs -
#62426
[PATCH] eshell: Add 'rgrep' builtin.
Previous Next
Reported by: Antero Mejr <antero <at> mailbox.org>
Date: Fri, 24 Mar 2023 21:03:01 UTC
Severity: normal
Tags: patch
Done: Antero Mejr <antero <at> mailbox.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
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.
This bug report was last modified 1 year and 356 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.