From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Antero Mejr via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#62426: [PATCH] eshell: Add 'rgrep' builtin. Date: Fri, 24 Mar 2023 21:02:18 +0000 Message-ID: <87jzz5eucl.fsf@mailbox.org> Reply-To: Antero Mejr Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="27057"; mail-complaints-to="usenet@ciao.gmane.io" To: 62426@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Mar 24 23:04:07 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pfpW3-0006hJ-Eg for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 24 Mar 2023 23:04:07 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pfpT8-0003wt-Ca; Fri, 24 Mar 2023 18:01:06 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pfpT5-0003tX-M5 for bug-gnu-emacs@gnu.org; Fri, 24 Mar 2023 18:01:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pfpT5-0000eY-DE for bug-gnu-emacs@gnu.org; Fri, 24 Mar 2023 18:01:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pfoYw-000884-52 for bug-gnu-emacs@gnu.org; Fri, 24 Mar 2023 17:03:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Antero Mejr Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 24 Mar 2023 21:03:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 62426 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.167969177331230 (code B ref -1); Fri, 24 Mar 2023 21:03:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 24 Mar 2023 21:02:53 +0000 Original-Received: from localhost ([127.0.0.1]:41483 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pfoYn-00087d-AY for submit@debbugs.gnu.org; Fri, 24 Mar 2023 17:02:53 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:34798) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pfoYk-00087U-QD for submit@debbugs.gnu.org; Fri, 24 Mar 2023 17:02:51 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pfoYk-0002xo-Fj for bug-gnu-emacs@gnu.org; Fri, 24 Mar 2023 17:02:50 -0400 Original-Received: from mout-p-103.mailbox.org ([80.241.56.161]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_CHACHA20_POLY1305:256) (Exim 4.90_1) (envelope-from ) id 1pfoYi-0004aj-BL for bug-gnu-emacs@gnu.org; Fri, 24 Mar 2023 17:02:50 -0400 Original-Received: from smtp202.mailbox.org (smtp202.mailbox.org [10.196.197.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-103.mailbox.org (Postfix) with ESMTPS id 4PjvmQ3sSvz9sdM for ; Fri, 24 Mar 2023 22:02:30 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mailbox.org; s=mail20150812; t=1679691750; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type; bh=dQIese//tZOBLmkdhTRIZvAekmP/hLORyT98OM8IJ5o=; b=jJZCTMCrzlJhMoehwLMPcP5xNcBbWb+FR4JKwNG278IGR/DeQMflzIBe0rd3iE//0ck2XQ w4qoPOFe1pQC3aSeeQsK3ZcAIQfruBcoxQ0V/qklAzr7gc29jQY4rVV21cWhM3DacOtE2I 1ppjO5A0u3rQDiWfE2QToj6KMVSBfznk85yw52VccTvHOpc8CKpe9lhh6Fp2wsikBkffvf 1znUvhkYiAaqu54EUSs1EalO3lv7Z1SDh2GwZ10SPUa1+pHs/pLvY3JenRwX38pJsFVPav w3l7r+HpUYynL4PyE/abgL9uaXQ4jsB4TVInNIsxkFfSYWHoBnHklnc/39wyGQ== X-MBO-RS-ID: dde246785088ed84075 X-MBO-RS-META: fkpybxgpzws6m91wnqopj344816qepq6 Received-SPF: pass client-ip=80.241.56.161; envelope-from=antero@mailbox.org; helo=mout-p-103.mailbox.org X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:258519 Archived-At: --=-=-= Content-Type: text/plain 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. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-eshell-Add-rgrep-builtin.patch >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 --=-=-=--