From debbugs-submit-bounces@debbugs.gnu.org Fri Mar 24 17:02:53 2023 Received: (at submit) by debbugs.gnu.org; 24 Mar 2023 21:02:53 +0000 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 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 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 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 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== From: Antero Mejr To: bug-gnu-emacs@gnu.org Subject: [PATCH] eshell: Add 'rgrep' builtin. Date: Fri, 24 Mar 2023 21:02:18 +0000 Message-ID: <87jzz5eucl.fsf@mailbox.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" 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-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) --=-=-= 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 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sat Mar 25 08:27:24 2023 Received: (at 62426) by debbugs.gnu.org; 25 Mar 2023 12:27:24 +0000 Received: from localhost ([127.0.0.1]:42021 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pg2zU-0004v9-70 for submit@debbugs.gnu.org; Sat, 25 Mar 2023 08:27:24 -0400 Received: from mail-oa1-f42.google.com ([209.85.160.42]:35397) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pg2zT-0004uv-6J for 62426@debbugs.gnu.org; Sat, 25 Mar 2023 08:27:23 -0400 Received: by mail-oa1-f42.google.com with SMTP id 586e51a60fabf-177ca271cb8so4525252fac.2 for <62426@debbugs.gnu.org>; Sat, 25 Mar 2023 05:27:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679747229; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:mime-version:date:message-id:from:to:cc :subject:date:message-id:reply-to; bh=Q71FraRDOOfXG7Dqk7odgslW2mKbY26+dLyxB0XyodY=; b=ZNMWYnFpf8f7aYTVAa7ehVJtunynS8Iju5txvWDoeoLKvQdcQmkH2PLmQxA3RDKCX+ pJ4TGxvNGVaVfP1EyCB8X73V2MxvqeR7w6FAASQoOa0p0uiuiLB6l9khDP2nMxSAb4TQ HO0Cv38HCIbAiAM3iiU72mOIfkZyLdZQdPPo9Y2eVZi4TFZpyNBAXKsefCFjK/2dM1Zm up7LDNoytcbijBd20gqmX5WNqaCEJF8K4d0S6IK9XvTNM3MiM7pWLmKTe3jECfv+znll 5C8jSGv4ZrL8NbHkar9WFGFNodjfQir45NnZgefxGLJgBHc4Eobi2oH7f/5D+UohtIFl AMcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679747229; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Q71FraRDOOfXG7Dqk7odgslW2mKbY26+dLyxB0XyodY=; b=n86RVQ926SGmBRlb6VM95ll9fZDlTlgPh8EbrGg2zEWH5d6Zml7jXH6kktflgtVEnK lpXm+wcTVFigr9e3rnrOB/AXPBGDi9x58GxRch6cQ6HGzOfTpbJdbDjoArCjpW8W4/ZL YO0XYpFVkAWiOLzV8rWfAO8S6QOxWYcn7K31Wh7FzPrXdi7XMXrPcGEaNBbQy0dRkZ/z ya3JNZEtPl/e0M34e+t7rvmyV5Z6dhC9imYsI6L0PWMRir9Reck5V6wgrgACCquk/jAc ruEWsmYsNRIjfDX/PhBnbPRNLL4UzAcaoehx1wwa5AsshPKmvcmz7qXChjrE9r6fdzN0 GH7g== X-Gm-Message-State: AAQBX9eR1YAmDUjPe1FGvExGkt4Gf/gmqYEiXMEsUctFpHNodZqzZeNg r+nDBKhlQ9yAIJHOukhHzjci+WRCb2M= X-Google-Smtp-Source: AKy350Y3topRkQSB+y0752DChVB7lgnbLYWJ/CziNDMCxrzOZPNmmKZvKU8P0bs1rPqdIut60snSXA== X-Received: by 2002:a17:90b:1e4a:b0:23b:7188:4b88 with SMTP id pi10-20020a17090b1e4a00b0023b71884b88mr4473451pjb.46.1679702696972; Fri, 24 Mar 2023 17:04:56 -0700 (PDT) Received: from [192.168.1.2] (cpe-76-168-148-233.socal.res.rr.com. [76.168.148.233]) by smtp.googlemail.com with ESMTPSA id s12-20020a632c0c000000b004fadb547d0csm13755705pgs.61.2023.03.24.17.04.56 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 24 Mar 2023 17:04:56 -0700 (PDT) Message-ID: Date: Fri, 24 Mar 2023 17:04:56 -0700 MIME-Version: 1.0 Subject: Re: bug#62426: [PATCH] eshell: Add 'rgrep' builtin. Content-Language: en-US To: Antero Mejr , 62426@debbugs.gnu.org References: <87jzz5eucl.fsf@mailbox.org> From: Jim Porter In-Reply-To: <87jzz5eucl.fsf@mailbox.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: 0.8 (/) X-Debbugs-Envelope-To: 62426 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.2 (/) On 3/24/2023 2:02 PM, Antero Mejr via Bug reports for GNU Emacs, the Swiss army knife of text editors wrote: > > 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. Thanks, I think it would make sense to add an rgrep built-in to Eshell. However, I'm not sure if this is the best way for it to work. Personally, I'd have expected this to use the 'rgrep' function in Emacs Lisp (which uses find + grep to do its job). That's a bit different from /usr/bin/rgrep, but I find it a lot more useful since it ignores "uninteresting" files by default. For example, 'M-x rgrep' in a Git repo ignores the .git/ subdir, but /usr/bin/rgrep includes that subdir. Hence, I'd almost always prefer Emacs' version of rgrep. 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... From debbugs-submit-bounces@debbugs.gnu.org Sat Mar 25 13:22:16 2023 Received: (at 62426) by debbugs.gnu.org; 25 Mar 2023 17:22:16 +0000 Received: from localhost ([127.0.0.1]:43385 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pg7aq-0007SN-BU for submit@debbugs.gnu.org; Sat, 25 Mar 2023 13:22:16 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:46463) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pg7ao-0007S8-1u for 62426@debbugs.gnu.org; Sat, 25 Mar 2023 13:22:15 -0400 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id B879B5C013E; Sat, 25 Mar 2023 13:22:08 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Sat, 25 Mar 2023 13:22:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=spwhitton.name; h=cc:cc:content-type:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm1; t=1679764928; x= 1679851328; bh=3Sd3xObocIGtl4OGXrWzAqy3A0sDjSYNIs+BAaFeKsA=; b=j 5STbt0RE4zee61qTEg86y8HDDzqHm9e1VSlwMknWKxnr2U+xzqq0SwDP5E4x061p sv3tNluiu4rf3/u2thwOQ5KxptKtTwtSh54J/GoKLN6Ev8BSMfZY2TlhD6z785kS fQbXQ4PZVl68QAdfvr3pxDue2YoPJce4g4O62HLtM/KL0kwSjdmt3vSJJtAc8FeG Jg/bM6N/LHr2mEhi4T+DDfObAQDNphMdm98gJLOCoE2Ru05N1pud8ygKzxzqMRpM 6y7PWSFqiPKXRAHeI/uYFsRrwdBdyPxd5jsD4gQakyyedvKjYvYIKs5iBSAA4Sp+ 6Wm3cMZ2rmzw8N8yN2mdg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; t=1679764928; x=1679851328; bh=3Sd3xObocIGtl 4OGXrWzAqy3A0sDjSYNIs+BAaFeKsA=; b=U2r1PFbu3T+WhgIeAdsPgX6jG0YSc 7Qw4l1tfPcCeR30TPne5M/kw0GzYedIywmVhKYGBfiT/N2CZCG/NRQT24qGHugxs LEaxp66Q6pbmcSZZGbTJSBpMDRWT9Vc5oFO174bRPI4/sIgrOVQM7hnbwq2rb29v EuhHk54YmD+/3GzTLgfSkmTYR7EtpJ9M/aUnUDCmJJJxOnPCCOAlYjorhTYYIY0G 3xED2eQUfPY7jmyfcFb74M5ykY6sY4CXfRHSpP3xDDJRDeBCl0J4yNDPM1hbTSH8 AH/yYEKU2vv/AMpA6IStnW6cZ4uue5O5pEqx+U5wMzJ6NRAOoI3ops/fg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrvdegkedguddtvdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefhvfevufgjfhffkfgfgggtsehttddttddtredtnecuhfhrohhmpefuvggr nhcuhghhihhtthhonhcuoehsphifhhhithhtohhnsehsphifhhhithhtohhnrdhnrghmvg eqnecuggftrfgrthhtvghrnheptdffvdffueeluedvteekvdevhefghedvgeevgffhvedu keeggeelveegjeekteeknecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrg hilhhfrhhomhepshhpfihhihhtthhonhesshhpfihhihhtthhonhdrnhgrmhgv X-ME-Proxy: Feedback-ID: i23c04076:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 25 Mar 2023 13:22:08 -0400 (EDT) Received: by athena.silentflame.com (Postfix, from userid 1000) id 2AFE21B5962; Sat, 25 Mar 2023 17:22:07 +0000 (UTC) From: Sean Whitton To: Jim Porter Subject: Re: bug#62426: [PATCH] eshell: Add 'rgrep' builtin. In-Reply-To: (Jim Porter's message of "Fri, 24 Mar 2023 17:04:56 -0700") References: <87jzz5eucl.fsf@mailbox.org> Date: Sat, 25 Mar 2023 10:22:07 -0700 Message-ID: <87355syce8.fsf@athena.silentflame.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 62426 Cc: Antero Mejr , 62426@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Hello, On Fri 24 Mar 2023 at 05:04PM -07, Jim Porter wrote: > On 3/24/2023 2:02 PM, Antero Mejr via Bug reports for GNU Emacs, the Swiss > army knife of text editors wrote: >> 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. > > Thanks, I think it would make sense to add an rgrep built-in to > Eshell. However, I'm not sure if this is the best way for it to > work. Personally, I'd have expected this to use the 'rgrep' function in Emacs > Lisp (which uses find + grep to do its job). That's a bit different from > /usr/bin/rgrep, but I find it a lot more useful since it ignores > "uninteresting" files by default. For example, 'M-x rgrep' in a Git repo > ignores the .git/ subdir, but /usr/bin/rgrep includes that subdir. Hence, I'd > almost always prefer Emacs' version of rgrep. > > 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. -- Sean Whitton From debbugs-submit-bounces@debbugs.gnu.org Sat Mar 25 15:07:48 2023 Received: (at 62426) by debbugs.gnu.org; 25 Mar 2023 19:07:48 +0000 Received: from localhost ([127.0.0.1]:43499 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pg9Ey-0001tw-IY for submit@debbugs.gnu.org; Sat, 25 Mar 2023 15:07:48 -0400 Received: from mail-pl1-f179.google.com ([209.85.214.179]:43670) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pg9Ev-0001tf-3T for 62426@debbugs.gnu.org; Sat, 25 Mar 2023 15:07:46 -0400 Received: by mail-pl1-f179.google.com with SMTP id kc4so4763977plb.10 for <62426@debbugs.gnu.org>; Sat, 25 Mar 2023 12:07:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679771259; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:mime-version:date:message-id:from:to:cc :subject:date:message-id:reply-to; bh=/WAXIJSrZZJl7HnnTGN/smygMI2lKT6icU6KC+yKln0=; b=nOGXnA8yVLcnNSfsujPau0eiT22eMKdNszpLxH1UVUWz6mcxCv248M6JsCspP3utXj yX/AP/wDDEaXl0Fc+qtk6XCTvWVeQEUgGgctzjbW4rrcV1gmHM20J/cBLOznRnJ+Q6M7 loFiczGShPiDtT0M+LR4tOse2gtjgAuYsXNNuKJO4K9qLeQYuhYTmdnR9Zjjh+DZcwIZ orTyf70cHx/f3Q8sWOhhZ2ssyMPiaWBqTZlf0wYW+3vGMv15w0pQnXYI1w98f+5kxtfS qSEep3lrWA+I9K0aFGU7Rb+QPmB/W3w16nXNssiQPRz1nCddHtas5JNitcoX4TQKSFk7 RNQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679771259; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=/WAXIJSrZZJl7HnnTGN/smygMI2lKT6icU6KC+yKln0=; b=DuVeATy33JDgrP9AhHlMbEzC0JtC1ciqUanT24ASOeJ9/UsxOTf6O7C/WbrKXiveU8 1HEWQlPMtTVmMuMfe/du/0TCCvKxEIqCMzSaC9PG+9v68UJby7TGSkL0iVy9lMfK7kCh zwXqra9iDCeqk1Jx7hJkb1iQXw0EgmqG5S/qWY+yqx5QxfV2qD7kyRYQ5umJoKUbZeFS cViBhXEpD8fcxDo/uc7H30nQXwypJoeRFm9jwilFF2WzIq8bNR+8PD/qc/lJa2Hi9Sck +y+bdXofNn35yzDv72gWei/0JroNvMqn7zUCTRtAaPdoF2jlSAvEN+Bc3ilBZdJsEsUW YATg== X-Gm-Message-State: AO0yUKUkuQ3QAwaDrXqox8nebY5HL9EjUAAqL4viAXigUwIgAemRz6ul FpwBZ0B3wPQEnLbfnOITqPs= X-Google-Smtp-Source: AK7set/eaVirvl0Vom4ygvleiFtWEfMTe15oEOXiVwOb3erizx7al66a4AeFNG9tj/3rdu3wNWCDhA== X-Received: by 2002:a05:6a20:4ca6:b0:d7:87ce:671e with SMTP id fq38-20020a056a204ca600b000d787ce671emr6247897pzb.52.1679771259081; Sat, 25 Mar 2023 12:07:39 -0700 (PDT) Received: from [192.168.1.2] (cpe-76-168-148-233.socal.res.rr.com. [76.168.148.233]) by smtp.googlemail.com with ESMTPSA id f19-20020aa78b13000000b0062cb3c8896dsm1578962pfd.142.2023.03.25.12.07.38 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 25 Mar 2023 12:07:38 -0700 (PDT) Message-ID: <314663e3-ff4e-814c-6ff7-6ab3376ef458@gmail.com> Date: Sat, 25 Mar 2023 12:07:37 -0700 MIME-Version: 1.0 Subject: Re: bug#62426: [PATCH] eshell: Add 'rgrep' builtin. To: Sean Whitton References: <87jzz5eucl.fsf@mailbox.org> <87355syce8.fsf@athena.silentflame.com> Content-Language: en-US From: Jim Porter In-Reply-To: <87355syce8.fsf@athena.silentflame.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 62426 Cc: Antero Mejr , 62426@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) 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.) From debbugs-submit-bounces@debbugs.gnu.org Thu Mar 30 17:19:21 2023 Received: (at 62426) by debbugs.gnu.org; 30 Mar 2023 21:19:21 +0000 Received: from localhost ([127.0.0.1]:59601 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1phzg0-0008KC-UT for submit@debbugs.gnu.org; Thu, 30 Mar 2023 17:19:21 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:56491) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1phzfy-0008Jv-2m for 62426@debbugs.gnu.org; Thu, 30 Mar 2023 17:19:18 -0400 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id DCC535C0058; Thu, 30 Mar 2023 17:19:10 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Thu, 30 Mar 2023 17:19:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=spwhitton.name; h=cc:cc:content-type:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm1; t=1680211150; x= 1680297550; bh=JKfnfWQWyOpzxLVsUsmbxinJrIoUex0/NetqdZ51Ul8=; b=X kWJTXz8epUbJv6pz727wN9hggp8RhQT8jLtxjybdr8wnRqUGEweph3KgbLZyd6C1 Ocxlk8OIhVxvkBEi/s9/Ho6Asb5FmZ2qBPkUgX+VfL/Ijd6Ddo7WoeWMyv3BPxxq 2z6Pl8BvwTqrrzraQ8rpUIjAavP6H3sNJD6OJpIn8IYIi00JXvdVlLv9nV3U6SFZ gzKu1/+EjayP0x3lmmGlk0bWsTUbfhHOXsX+Sw/AuMBm+29uD7QQQWV9CPQ2xS2k QYG8NzGWN7m/F/cM+IqHU40auWgbQ4uHofwEG3i5MjKW4+Uv8oZWfvfO7ImKrdyU tP7WWKXAtTrMuW+H9Eqpw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; t=1680211150; x=1680297550; bh=JKfnfWQWyOpzx LVsUsmbxinJrIoUex0/NetqdZ51Ul8=; b=KbjN3TczBileOEd0pZM+ag+r8WKjc xttC+Jn2tWoudYVp0ZYwznOnoovFB4jzuhSB1OaHPWuV+w1jk4gFRrfwqnY5OkEF 211uvZj7OW3hKDiPEl9GzmofcVZ7T4JBc7Io/xyHca90yZrxHxcYrt4PPTipIJFV YotLg8GGr5L3H72j6F4sLY+esoPJpiM6Ng8euAa2hjBhiCTL7cY8voVUHtVW956U 5d8d+4I4z53K1XncvbqE/jzSke71a0gL23SVRf2B8knwac9Ao/9xy1/eLYDHxel6 AaSCOXzSzLimdio7+FpXkbC1dPa7vmojEFhkuiiHTJay98MytnRTsazMw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrvdehledgieekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefujghffffkfgggtgesthdttddttdertdenucfhrhhomhepufgvrghn ucghhhhithhtohhnuceoshhpfihhihhtthhonhesshhpfihhihhtthhonhdrnhgrmhgvqe enucggtffrrghtthgvrhhnpedtffdvffeuleeuvdetkedvveehgfehvdegvefghfevudek geegleevgeejkeetkeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrih hlfhhrohhmpehsphifhhhithhtohhnsehsphifhhhithhtohhnrdhnrghmvg X-ME-Proxy: Feedback-ID: i23c04076:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 30 Mar 2023 17:19:10 -0400 (EDT) Received: by melete.silentflame.com (Postfix, from userid 1000) id B824C7EFC34; Thu, 30 Mar 2023 14:19:08 -0700 (MST) From: Sean Whitton To: Jim Porter Subject: Re: bug#62426: [PATCH] eshell: Add 'rgrep' builtin. In-Reply-To: <314663e3-ff4e-814c-6ff7-6ab3376ef458@gmail.com> (Jim Porter's message of "Sat, 25 Mar 2023 12:07:37 -0700") References: <87jzz5eucl.fsf@mailbox.org> <87355syce8.fsf@athena.silentflame.com> <314663e3-ff4e-814c-6ff7-6ab3376ef458@gmail.com> Date: Thu, 30 Mar 2023 14:19:08 -0700 Message-ID: <87o7oavsxf.fsf@melete.silentflame.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 62426 Cc: Antero Mejr , 62426@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Hello, On Sat 25 Mar 2023 at 12:07PM -07, Jim Porter wrote: > 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. Can you give a concrete use case? If you're piping won't you typically want to reuse your knowledge of traditional grep(1)? If I'm piping then I'm probably thinking in non-Emacs terms. > 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.) A command-specific defcustom doesn't seem ideal because we could end up with very many such things. Something like your compilation buffer idea sounds good. -- Sean Whitton From debbugs-submit-bounces@debbugs.gnu.org Thu Mar 30 20:14:59 2023 Received: (at 62426) by debbugs.gnu.org; 31 Mar 2023 00:14:59 +0000 Received: from localhost ([127.0.0.1]:59875 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pi2Pz-0001IY-1x for submit@debbugs.gnu.org; Thu, 30 Mar 2023 20:14:59 -0400 Received: from mail-pj1-f51.google.com ([209.85.216.51]:41703) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pi2Pw-0001IK-TC for 62426@debbugs.gnu.org; Thu, 30 Mar 2023 20:14:57 -0400 Received: by mail-pj1-f51.google.com with SMTP id fy10-20020a17090b020a00b0023b4bcf0727so21634796pjb.0 for <62426@debbugs.gnu.org>; Thu, 30 Mar 2023 17:14:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1680221691; x=1682813691; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:mime-version:date:message-id:from:to:cc :subject:date:message-id:reply-to; bh=NeLnD2AB5U4G/lqFSeQPahthI0CMgSMveG/H+fhyhdw=; b=VjHjJhiQOBF/2wJ974JQbDRWkjyxOCwhytICeSN3Fj5NFFys6QzmfDyjhgKKlC0PnZ RZ6vWvoK47etBdRzMdQcFDOFyJcb9pP3dtFv7sYdxAAzyuv6/RGwzbHQbygeF9wtqIzF knxA6kzpDWhGa4X4lhFy0kHp3uw3LHRlA/mhiZnmEscbENuA7XO5tStwfzq7AiyiOp3E 0aekVih4OQ3lfUZTxIZI/dDJk+vGmhfgPVxOfyLp3wrAtCeemOte84i0jTqYTAEQOiJw jeKWUuUi1MS+rstMEdoa1rowvFzz2wlZ8W75zEuUNxdqrzMx9KJF5hUBoSswiFHdWuDO lefg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680221691; x=1682813691; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=NeLnD2AB5U4G/lqFSeQPahthI0CMgSMveG/H+fhyhdw=; b=0SBvIzlkK5v7u04ZbC5wFZMQ+YWooTjGLW+h1C1qrHqZRGz9jidm8ASxL/s4SvF60s y/e2kcFmfAc/C5LWRAtE5JsuPXBPenKm6VEjWRRFEJbopTOR2p5OCtDkHcSL+HYLNuaX 01FDW51bAE5zVrAUuf/1iL4tG6eYSFpVdfFgtv8ngmIRa/p9wqv2H6hDiO0UOLDe3V47 qidpBGfFkFP8NJvuUFoAzt29n7zYMia1fXQPFe+GmvpPnwAvWq1t3Cq2IH2efWgATWPQ 8/u//zTI0zoqLM1pV21AzNiKa8c6+zZ5RguhDR33uz5541AZ8ymf3Qf/YSv/TZxNdYzf J2TQ== X-Gm-Message-State: AO0yUKWy6p7Wyy5+r/8MAWtMgMARsZ7Ju7SjWV1gprF8JgxoDRDWnffC UrxkwvzJ4wmMO5EKiCh55DY= X-Google-Smtp-Source: AK7set9OhFZhZDBQn+sBGjOSoEZir0TIF3e90C6mt2h1vg+/Q9N3CWcBmC0wPDLte2jEl+IzPqjbkw== X-Received: by 2002:a05:6a20:b288:b0:d9:2818:441 with SMTP id ei8-20020a056a20b28800b000d928180441mr21859094pzb.5.1680221690492; Thu, 30 Mar 2023 17:14:50 -0700 (PDT) Received: from [192.168.1.2] (cpe-76-168-148-233.socal.res.rr.com. [76.168.148.233]) by smtp.googlemail.com with ESMTPSA id c16-20020aa78c10000000b005e5b11335b3sm435919pfd.57.2023.03.30.17.14.49 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 30 Mar 2023 17:14:50 -0700 (PDT) Message-ID: <8c94b46f-e360-087e-cb80-bf27ac76d2f9@gmail.com> Date: Thu, 30 Mar 2023 17:14:49 -0700 MIME-Version: 1.0 Subject: Re: bug#62426: [PATCH] eshell: Add 'rgrep' builtin. Content-Language: en-US To: Sean Whitton References: <87jzz5eucl.fsf@mailbox.org> <87355syce8.fsf@athena.silentflame.com> <314663e3-ff4e-814c-6ff7-6ab3376ef458@gmail.com> <87o7oavsxf.fsf@melete.silentflame.com> From: Jim Porter In-Reply-To: <87o7oavsxf.fsf@melete.silentflame.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 62426 Cc: Antero Mejr , 62426@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On 3/30/2023 2:19 PM, Sean Whitton wrote: >> 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. > > Can you give a concrete use case? If you're piping won't you typically > want to reuse your knowledge of traditional grep(1)? If I'm piping then > I'm probably thinking in non-Emacs terms. I'm somewhat biased (or maybe I've just thought about this too much?) because I wrote urgrep[1], which is essentially an extension of the basic recursive-grep concept: it provides a layer of abstraction over *any* recursive-grep-like command (rgrep, ag, ack, etc) so that you have a single API and can use whatever the flavor of the week is (possibly even using different programs on remote hosts). In that package, I wrote an Eshell command, also called "urgrep", that replaces the user-entered command with whatever the *real* command is; then you can use that in Eshell like it's a regular command and pipe it around and do all the usual shell things with it. The Eshell urgrep command is designed to feel like grep so that you can (mostly) use your existing knowledge to search for things. For Eshell's "rgrep" support, I think you could do the same thing without too much work, even if it delegated to "M-x rgrep" instead of "/usr/bin/rgrep". Since I almost never want to search the files in my .git dir, "M-x rgrep" is more convenient for me. That said, ... >> 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: [snip] > A command-specific defcustom doesn't seem ideal because we could end up > with very many such things. Something like your compilation buffer idea > sounds good. My thinking here was that some users might simply prefer "M-x rgrep", and others might prefer /usr/bin/rgrep. Having an easy way to make Eshell conform to users' preferences would be nice. But maybe we could do this by defaulting to use "M-x rgrep", and making it very easy to write an alias to prefer /usr/bin/rgrep (e.g. with the compilation-buffer wrapper I suggested). We could even document this explicitly in the manual. I'll try to get at least a prototype of this into a patch in a week or so. Then people can try it out and have something a little less nebulous to comment on. [1] https://github.com/jimporter/urgrep From debbugs-submit-bounces@debbugs.gnu.org Sat Apr 08 21:55:15 2023 Received: (at 62426) by debbugs.gnu.org; 9 Apr 2023 01:55:15 +0000 Received: from localhost ([127.0.0.1]:59959 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1plKGw-0000CG-OF for submit@debbugs.gnu.org; Sat, 08 Apr 2023 21:55:15 -0400 Received: from mail-pl1-f169.google.com ([209.85.214.169]:43888) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1plKGv-0000Bq-I5 for 62426@debbugs.gnu.org; Sat, 08 Apr 2023 21:55:14 -0400 Received: by mail-pl1-f169.google.com with SMTP id 20so3796502plk.10 for <62426@debbugs.gnu.org>; Sat, 08 Apr 2023 18:55:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1681005308; x=1683597308; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:mime-version:date:message-id:from:to:cc :subject:date:message-id:reply-to; bh=3lYhRB92Hnebaai6Vpo2MN9JhssWOZUoKMIIFpBh/e0=; b=hJr1I4znu+9QmOx/sEfRbTKyOP1usNM2U4+8wohKQicK5eWPYJx0JPSBpjMbRq5Pg9 8FyBXc2XO90W4wBBI+x1GdFH75KIIBXmDOgLH2v3cqzAG+6y4GXd2ANli98GIKb7TUtz 4qmBF3eaNV7gIt5VMWIk9b98CdpHEZl6mQZMl6S50LkzgjBsqJTB0Z+92HIftP+eCHPG JsvcaYAalMXH5pw7FeJ2bDaij1em7ESinkuYKUdcOQnexoiibKyqnpS8a5VO9hrJi5r1 NgmjzF04jwGypt0kFQCNVH5VzXMIqzOxKJ93UuG3y/Teg71q8SLVlV9Tr/woVYRVNMWF JO3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1681005308; x=1683597308; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=3lYhRB92Hnebaai6Vpo2MN9JhssWOZUoKMIIFpBh/e0=; b=mAuhTojERaRuG9rxd+f2pq62ivIhFnJ07s26vbD6arWkNskWnIRiUgNMs2b+bdoWLO XbCjQJUyyYBplZhr9qMmrIRSNHtniN7ouUuPwvmi/2lbzrge0YnEvTnaKwk0fgNhtgh7 kR7r91Jv211ABc4xNTXoaGuo1QnUh076LFvFbkr9HfjDjdtsk//cRqJ7KfvgCr+P3X8V 14IM9j+6oOxgWaV/FOe5Fz2iMIZ7pvg+UIZT8ZrH6KhHXERULuKazov6YisEkHPRT8c3 98+20MlKZvHx96Qz6D+D6UJRRrUW4ErSkyHJA/Vi68xYHfpeHoIDJPCOL97/JxpUlBf/ WlTw== X-Gm-Message-State: AAQBX9ef3nv5q6eIx0bj/8T225ApGe3S4JcxpQMxIJ9IPXB/KgMZSK1V LfWXpu9m9EHvGMuAkpYMbuQ= X-Google-Smtp-Source: AKy350Yx1uU4ssqtomlm7yPZoItQiypyIb4NCFdDRKucNyovqoC4NheNMzlbWLfskNY+jbvgoMdnow== X-Received: by 2002:a17:902:ced2:b0:19e:7a2c:78a7 with SMTP id d18-20020a170902ced200b0019e7a2c78a7mr9808950plg.57.1681005307562; Sat, 08 Apr 2023 18:55:07 -0700 (PDT) Received: from [192.168.1.2] (cpe-76-168-148-233.socal.res.rr.com. [76.168.148.233]) by smtp.googlemail.com with ESMTPSA id k22-20020a170902761600b0019cb6222691sm4819699pll.133.2023.04.08.18.55.06 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 08 Apr 2023 18:55:07 -0700 (PDT) Message-ID: Date: Sat, 8 Apr 2023 18:55:06 -0700 MIME-Version: 1.0 Subject: Re: bug#62426: [PATCH] eshell: Add 'rgrep' builtin. Content-Language: en-US To: Sean Whitton References: <87jzz5eucl.fsf@mailbox.org> <87355syce8.fsf@athena.silentflame.com> From: Jim Porter In-Reply-To: <87355syce8.fsf@athena.silentflame.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 62426 Cc: Antero Mejr , 62426@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) 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. From debbugs-submit-bounces@debbugs.gnu.org Mon Apr 10 22:13:07 2023 Received: (at 62426) by debbugs.gnu.org; 11 Apr 2023 02:13:07 +0000 Received: from localhost ([127.0.0.1]:36217 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pm3VL-0005p6-3Y for submit@debbugs.gnu.org; Mon, 10 Apr 2023 22:13:07 -0400 Received: from mout-p-103.mailbox.org ([80.241.56.161]:55474) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pm3VH-0005oZ-DP for 62426@debbugs.gnu.org; Mon, 10 Apr 2023 22:13:05 -0400 Received: from smtp102.mailbox.org (smtp102.mailbox.org [IPv6:2001:67c:2050:b231:465::102]) (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 4PwTrl2cdSz9sky; Tue, 11 Apr 2023 04:12:55 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mailbox.org; s=mail20150812; t=1681179175; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=V4nNInJNXcw6q4jV44I9QZpVk7OBclBGCngUdwWHiKc=; b=piFTtxR6mbv3w1unBAve7YVlUfv/iTuB75bGd9OouXJ5PxXB5gCRcGkQexsQ8OEDI6u+O+ wt/zKIPGtrhlD+H+XbpzLW89+SiDT/0ClJOk/eDR3VDFKsQK42fTJqNaAatb62ZubixSnc WRU39NXUKLlkDTChn7ytCOh1qSAZsvhlY5GZGcnMtAUvPfCRnEl8Ymb8HD51boPufXBHR6 6+vY+9hLCbiuvdq1P73cLdee70oRqIXFGa/NgVJFfEm4YWtGR7P69CBda5ZdsWxbez9zh0 Khl2l3yOc2MzO6DLToHEv4K9RvNj9smxZGFJfqe247B9jTTNi+RgiYApCXM3sA== From: Antero Mejr To: Jim Porter Subject: Re: bug#62426: [PATCH] eshell: Add 'rgrep' builtin. In-Reply-To: (Jim Porter's message of "Sat, 8 Apr 2023 18:55:06 -0700") References: <87jzz5eucl.fsf@mailbox.org> <87355syce8.fsf@athena.silentflame.com> Date: Tue, 11 Apr 2023 02:12:52 +0000 Message-ID: <87fs97np3v.fsf@mailbox.org> MIME-Version: 1.0 Content-Type: text/plain X-MBO-RS-META: c3nqr6iogd4ged5ign9zutwa89p4cm51 X-MBO-RS-ID: 36ea6620d49605fd300 X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 62426 Cc: 62426@debbugs.gnu.org, Sean Whitton X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Jim Porter writes: > 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. I don't think that's always the case. In the "eshell-grep" function it checks if external grep is available, and if not then it uses a slow elisp-only implementation. Then it checks to see if the output is being redirected, and so on. IMO that entire process constitutes the "emacs grep facility" as described in the docstring. > 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. I think the "Emacs grep facility" description is technically accurate and concise enough for the eshell/*grep stub functions. > 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. Thanks for the review and discussion. From debbugs-submit-bounces@debbugs.gnu.org Tue Apr 11 00:02:01 2023 Received: (at 62426) by debbugs.gnu.org; 11 Apr 2023 04:02:01 +0000 Received: from localhost ([127.0.0.1]:36282 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pm5Ci-0002r7-Oo for submit@debbugs.gnu.org; Tue, 11 Apr 2023 00:02:01 -0400 Received: from mail-pl1-f180.google.com ([209.85.214.180]:34441) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pm5Ce-0002qt-HY for 62426@debbugs.gnu.org; Tue, 11 Apr 2023 00:01:58 -0400 Received: by mail-pl1-f180.google.com with SMTP id h24so6771968plr.1 for <62426@debbugs.gnu.org>; Mon, 10 Apr 2023 21:01:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1681185710; x=1683777710; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:mime-version:date:message-id:from:to:cc :subject:date:message-id:reply-to; bh=CUO2pyDT6OlS4H+mYTGNwOSENqnNHsCoYK2YS6HJ820=; b=RXf/Hka54rs6tkAx0VMC+tiEGaUaTTufSL0ewlXVm3XDo9qnMM4kWO2EkLr1fwKyyh TEQITRXiW5ugc0rwJ7UXiW1RLVr1dWLvObi0X1mOc/qXdGfQuTqBy3C0kwZpRxRoq9V8 fAmrewbWiCRAiOW15KEvpSVz/REz9uBt39AfUJY6C5nr8i1CIPc3SpIbhwkjFsoM4tfm whmK3djcU5SKCvNwZT63fDco+qI5X/p0qxqknIYOTKoTiGX9Abm9kpC/sznO3oHcc8Th bRFQisiFqGBBwqpJezAMvDlcffTqPVEccSsCpmcipQPsvSd8nZKe6orA+DfFfDTIuIHj B7vw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1681185710; x=1683777710; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=CUO2pyDT6OlS4H+mYTGNwOSENqnNHsCoYK2YS6HJ820=; b=OxiTr+jM0lpem+KwRQ/W7onVR8D7FTcS1Czb8u4WGhjTJJ3t394A4+uWYccFkhfjc/ QSRKREpo/b1h6cm9Ru2xgTNK1eJkXVImESq+Ci/sAAWSJ0UnNo55R3xhMvoO+Nu24tQL Ow0XxOQquFkwYK6jPsoQC8oOikqeBL3nlMbTy4czNFcoAhD4YIykTrs9Oze7ufrN/7EK IxE/AW2fUc1Rst+t2kQGtClUTWAfSN5LtyR4ExoXXI61U6MlIAIrXrhcyoRnMLF02X/z ojhdJT7h0gERxv5jh98L6cPQTC8AcDRZhVLjAkcaNpssToTnzvDGloMz9eS8LRLXAi2f dKxg== X-Gm-Message-State: AAQBX9dnOjr6z/LIk9NW4ty/U3oKbKtil2ChXo6xZ4ynAmoxLSHsWisz 93eENw/7/nBjSL3N/6tq8sw= X-Google-Smtp-Source: AKy350acCjOfemekhuKVMUOZ/JQGoJz+odv1xvWBBYu1ekMplyapGadKFryLWeYxil8IzJrYeyj6uQ== X-Received: by 2002:a17:903:1250:b0:1a5:a1b:bbd8 with SMTP id u16-20020a170903125000b001a50a1bbbd8mr18314802plh.45.1681185710010; Mon, 10 Apr 2023 21:01:50 -0700 (PDT) Received: from [192.168.1.2] (cpe-76-168-148-233.socal.res.rr.com. [76.168.148.233]) by smtp.googlemail.com with ESMTPSA id f22-20020a63f756000000b005142206430fsm7619119pgk.36.2023.04.10.21.01.49 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 10 Apr 2023 21:01:49 -0700 (PDT) Message-ID: <2a8bf589-ad5a-151b-096c-ab86f90c5c4e@gmail.com> Date: Mon, 10 Apr 2023 21:01:49 -0700 MIME-Version: 1.0 Subject: Re: bug#62426: [PATCH] eshell: Add 'rgrep' builtin. Content-Language: en-US To: Antero Mejr References: <87jzz5eucl.fsf@mailbox.org> <87355syce8.fsf@athena.silentflame.com> <87fs97np3v.fsf@mailbox.org> From: Jim Porter In-Reply-To: <87fs97np3v.fsf@mailbox.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 62426 Cc: eliz@gnu.org, 62426@debbugs.gnu.org, Sean Whitton X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On 4/10/2023 7:12 PM, Antero Mejr via Bug reports for GNU Emacs, the Swiss army knife of text editors wrote: > Jim Porter writes: > >> 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. > > I don't think that's always the case. In the "eshell-grep" function it > checks if external grep is available, and if not then it uses a slow > elisp-only implementation. Then it checks to see if the output is being > redirected, and so on. > > IMO that entire process constitutes the "emacs grep facility" as > described in the docstring. Good point. There's probably a way to indicate that more clearly, but I'll think it over. It shouldn't hold up merging this. Therefore, I've merged your patch as ebac67129e8. This change is pretty close to the limit for changes that you can make without assigning copyright to the FSF (15 lines). I'm not sure if you've filled out the paperwork (I don't think I have the permissions to check directly), but if not, do you want to fill it out so you can make more changes to Emacs in the future? I think Eli (CCed) can get you started if so. From debbugs-submit-bounces@debbugs.gnu.org Fri Jun 02 21:41:22 2023 Received: (at 62426-done) by debbugs.gnu.org; 3 Jun 2023 01:41:22 +0000 Received: from localhost ([127.0.0.1]:41090 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q5GGc-0006e5-BL for submit@debbugs.gnu.org; Fri, 02 Jun 2023 21:41:22 -0400 Received: from mout-p-101.mailbox.org ([80.241.56.151]:33560) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q5GGW-0006do-Rl for 62426-done@debbugs.gnu.org; Fri, 02 Jun 2023 21:41:17 -0400 Received: from smtp2.mailbox.org (smtp2.mailbox.org [10.196.197.2]) (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-101.mailbox.org (Postfix) with ESMTPS id 4QY2dX49Ljz9sNf for <62426-done@debbugs.gnu.org>; Sat, 3 Jun 2023 03:41:04 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mailbox.org; s=mail20150812; t=1685756464; h=from:from:reply-to:subject:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type; bh=47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=; b=DvNQWYrNCttlEiQOG/ly/NWUykWnyugrMv9jVg/X+9Q09AbtaJMWcRjSiQaaNCPq72MjDY Oc3+4InpknXIlqhdgZfDmAYzZ7PPRXe3M8H7Zv5pL97vyQEfltQq4GNZAcNuebbemIWjXc cnpEZonPgFSYIxgKqIIR5pScZMBhXi7fp735MJ6RiGCAXS7zr/IptUCjpC0QZmXh9JLoeK p8Sn0SIBrrLY5vwXHk6wvRjfRkAj0SoyNLzWaFKQ2tlcCLDdAx8t+cf7zg6Db06cN+1SsT 2DqcobDkdu7CelVE2fqnYqYeMMyeu6wvXenm9hQFyNJC98yjeSyVCM6i0hhYlw== From: Antero Mejr To: 62426-done@debbugs.gnu.org Date: Sat, 03 Jun 2023 01:41:00 +0000 Message-ID: <87h6rpb9w3.fsf@mailbox.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-MBO-RS-META: jrwq8xr4szfzdbcz1c3gmm58r37546mx X-MBO-RS-ID: 28d81c36e91210f2cc5 X-Spam-Score: 3.6 (+++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Content analysis details: (3.6 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [80.241.56.151 listed in list.dnswl.org] 2.3 EMPTY_MESSAGE Message appears to have no textual parts 1.8 MISSING_SUBJECT Missing Subject: header 0.2 NO_SUBJECT Extra score for no subject X-Debbugs-Envelope-To: 62426-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 2.6 (++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Content analysis details: (2.6 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [80.241.56.151 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 2.3 EMPTY_MESSAGE Message appears to have no textual parts 1.8 MISSING_SUBJECT Missing Subject: header 0.2 NO_SUBJECT Extra score for no subject -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager From unknown Fri Aug 15 15:57:40 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sat, 01 Jul 2023 11:24:06 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator