From 7a56cea33b5f6d0025003405b83da028e93576a8 Mon Sep 17 00:00:00 2001 From: Antero Mejr 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