unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Tomas Hlavaty <tom@logand.com>
To: help-gnu-emacs@gnu.org
Subject: grep counting matches only with --color argument
Date: Sun, 28 Feb 2021 00:07:30 +0100	[thread overview]
Message-ID: <87lfb9t8i5.fsf@logand.com> (raw)

Hi,

why does this command shows the number of matches in the mode-line

   (grep "grep -r --color -nH -e TODO ~/git/emacs-pdf")

but this one (without --color argument) always shows 0?

   (grep "grep -r -nH -e TODO ~/git/emacs-pdf")

Is there a deeper reason that --color is required to see the number of
matches?  Could it simply count the number of matched lines if no
--color was specified?  Or is it not easy to detect?

I would like to see the number of matches with alternative programs like
ripgrep:

   (grep "rg -nH --no-heading --color=always -e TODO ~/git/emacs-pdf")
   (grep "rg -nH --no-heading --color=ansi -e TODO ~/git/emacs-pdf")

But the --color argument here does not seem to have an effect.

Thanks in advance,

Tomas



             reply	other threads:[~2021-02-27 23:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-27 23:07 Tomas Hlavaty [this message]
2021-03-02 19:33 ` grep counting matches only with --color argument Juri Linkov
2021-03-02 21:33   ` Tomas Hlavaty

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=87lfb9t8i5.fsf@logand.com \
    --to=tom@logand.com \
    --cc=help-gnu-emacs@gnu.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.
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).