unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Antero Mejr via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: 62426@debbugs.gnu.org
Subject: bug#62426: [PATCH] eshell: Add 'rgrep' builtin.
Date: Fri, 24 Mar 2023 21:02:18 +0000	[thread overview]
Message-ID: <87jzz5eucl.fsf@mailbox.org> (raw)

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


eshell has builtins for agrep/egrep/fgrep that use the Emacs grep
feature, but rgrep is not included so it behaves differently. This patch
adds the rgrep builtin.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-eshell-Add-rgrep-builtin.patch --]
[-- Type: text/x-patch, Size: 2429 bytes --]

From 7a56cea33b5f6d0025003405b83da028e93576a8 Mon Sep 17 00:00:00 2001
From: Antero Mejr <antero@mailbox.org>
Date: Fri, 24 Mar 2023 20:41:41 +0000
Subject: [PATCH] eshell: Add 'rgrep' builtin.

* lisp/eshell/em-unix.el (eshell/rgrep): New procedure.
(eshell-unix-initialize): Add "rgrep" to eshell-complex-commands.
* etc/NEWS: Add NEWS entry for rgrep.
* doc/misc/eshell.texi (Built-ins): Add documentation for rgrep.
---
 doc/misc/eshell.texi   | 2 ++
 etc/NEWS               | 5 +++++
 lisp/eshell/em-unix.el | 8 ++++++--
 3 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/doc/misc/eshell.texi b/doc/misc/eshell.texi
index 1c33c04f647..4e2bddf42af 100644
--- a/doc/misc/eshell.texi
+++ b/doc/misc/eshell.texi
@@ -602,6 +602,8 @@ Built-ins
 @cmindex egrep
 @itemx fgrep
 @cmindex fgrep
+@itemx rgrep
+@cmindex rgrep
 @itemx glimpse
 @cmindex glimpse
 The @command{grep} commands are compatible with GNU @command{grep},
diff --git a/etc/NEWS b/etc/NEWS
index 2a87bf08406..240ecb37f62 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -174,6 +174,11 @@ correctly unloads Eshell and all of its modules.
 After manually editing 'eshell-aliases-file', you can use this command
 to load the edited aliases.
 
++++
+*** 'rgrep' is now an builtin command.
+Running "rgrep" is eshell now uses the Emacs grep facility instead of
+calling external rgrep.
+
 ** Prog Mode
 
 +++
diff --git a/lisp/eshell/em-unix.el b/lisp/eshell/em-unix.el
index d550910f4f0..0681ba11691 100644
--- a/lisp/eshell/em-unix.el
+++ b/lisp/eshell/em-unix.el
@@ -145,8 +145,8 @@ eshell-unix-initialize
     (add-hook 'pcomplete-try-first-hook
 	      'eshell-complete-host-reference nil t))
   (setq-local eshell-complex-commands
-	(append '("grep" "egrep" "fgrep" "agrep" "glimpse" "locate"
-		  "cat" "time" "cp" "mv" "make" "du" "diff")
+	(append '("grep" "egrep" "fgrep" "agrep" "rgrep" "glimpse"
+		  "locate" "cat" "time" "cp" "mv" "make" "du" "diff")
 		eshell-complex-commands)))
 
 (defalias 'eshell/date     'current-time-string)
@@ -773,6 +773,10 @@ eshell/agrep
   "Use Emacs grep facility instead of calling external agrep."
   (eshell-grep "agrep" args))
 
+(defun eshell/rgrep (&rest args)
+  "Use Emacs grep facility instead of calling external rgrep."
+  (eshell-grep "grep" (append '("-rH") args) t))
+
 (defun eshell/glimpse (&rest args)
   "Use Emacs grep facility instead of calling external glimpse."
   (let (null-device)
-- 
2.38.1


             reply	other threads:[~2023-03-24 21:02 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-24 21:02 Antero Mejr via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2023-03-25  0:04 ` bug#62426: [PATCH] eshell: Add 'rgrep' builtin 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
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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87jzz5eucl.fsf@mailbox.org \
    --to=bug-gnu-emacs@gnu.org \
    --cc=62426@debbugs.gnu.org \
    --cc=antero@mailbox.org \
    /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 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).