GNU bug report logs - #70507
30.0.50; eshell: grep -H and -n flags are hardcoded and the latter cannot be overwritten

Previous Next

Package: emacs;

Reported by: Jose A Ortega Ruiz <jao <at> gnu.org>

Date: Mon, 22 Apr 2024 01:31:04 UTC

Severity: wishlist

Found in version 30.0.50

Full log


View this message in rfc822 format

From: Jim Porter <jporterbugs <at> gmail.com>
To: Stefan Kangas <stefankangas <at> gmail.com>, Jose A Ortega Ruiz <jao <at> gnu.org>,  70507 <at> debbugs.gnu.org
Subject: bug#70507: 30.0.50; eshell: grep -H and -n flags are hardcoded and the latter cannot be overwritten
Date: Mon, 20 May 2024 13:52:29 -0700
On 5/20/2024 1:18 PM, Stefan Kangas wrote:
> Jose A Ortega Ruiz <jao <at> gnu.org> writes:
> 
>> I've noticed that -Hn flags are hardcoded when calling eshell's grep
>> command. Specially in pipes, where -H prints a noisy (standard input)
>> prefix for every line, those flags are rarely what I personally want,
>> and I'd like to have the option to disable them. For -H i can add -h to
>> the call, or even redefine eshell/grep to not use -H, but there's no
>> flag to disable -n.
> 
> Jim, any comments on the above bug report?

It would probably be reasonable to define some new 
'eshell-grep-default-interactive-flags' variable, defaulting to "-nH" 
and only taking effect when being redirected to a compilation buffer. 
Maybe 'eshell-compile' could also take an EXTRA-ARGS argument that holds 
extra args to use. There are a few edge cases here I haven't fully 
though through, so maybe this is all wrong.

In the short term though, you have a few options:

1. "alias grep '*grep $@*'": This just makes "grep" always use the real 
"grep" program on your computer, with no fancy compilation buffers.

2. "alias grep 'compile --mode=grep-mode grep $@*'": This ensures that 
"grep" opens in a compilation buffer when called interactively (and not 
in a pipeline, etc), but only with the flags you explicitly specify.




This bug report was last modified 166 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.