all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
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, 25 Mar 2023 12:07:37 -0700	[thread overview]
Message-ID: <314663e3-ff4e-814c-6ff7-6ab3376ef458@gmail.com> (raw)
In-Reply-To: <87355syce8.fsf@athena.silentflame.com>

On 3/25/2023 10:22 AM, Sean Whitton wrote:
> 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.

It wouldn't be too difficult to add Pcomplete support for an "rgrep" 
Eshell command that calls 'M-x rgrep' under the hood. There's no reason 
you'd *have* to explicitly type all three arguments to 'M-x rgrep' on 
the command line. (Though doing this the Right Way would take a bit of 
effort, since we'd probably want 'eshell-eval-using-options' to 
automatically generate the appropriate Pcomplete function.)

Even without Pcomplete support, there's still a benefit to a command 
like this though: you could use Eshell to pipe the results of 'M-x 
rgrep' to some other command. Looking at the code for 'eshell-grep', I 
don't think it'd be terribly difficult to support this case.

> Given this, I suggest rgrep in Eshell should be /usr/bin/rgrep.

Maybe there should be a defcustom for this ("use M-x rgrep" vs "use 
/usr/bin/rgrep")? Or maybe it should be easier to configure various 
Eshell commands so they open in a compilation buffer when appropriate? 
You can do this now with an alias, but the syntax is a bit tricky:

   alias rgrep 'eshell-grep grep ${append (list "-rH") $*}'

Something like this would be nicer:

   alias rgrep 'to-compilation-buffer rgrep -rH $*'

That would make it easier for users to define their own commands that 
work like this, which would (probably) be generally useful and provide a 
partial solution for this bug while we consider the available options. 
(My main goal with doing this now is so that we don't merge something 
and then change our minds later, disrupting users' habits.)





  reply	other threads:[~2023-03-25 19:07 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 [this message]
2023-03-30 21:19       ` Sean Whitton
2023-03-31  0:14         ` Jim Porter
2023-04-09  1:55     ` Jim Porter
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=314663e3-ff4e-814c-6ff7-6ab3376ef458@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.