Subject: bug#35326: 26.1; vc-git-grep should pass -i like isearch

From: Juri Linkov <[email-masked]>
Date: Mon, 24 Jun 2019 00:38:50 +0300

> Hm...  The default grep command on my machine (Debian GNU/Linux stretch)
> is "grep --color -nH --null -e", so it is case sensitive.
>
> Oh, lgrep does add the -i parameter:
>
> grep [...] --color -i -nH --null -e
> compile-goto-error *.el
>
> Confusing.
>
>> Obviously, it's also possible for users to customize that variable
>> themselves and add that string, but it's less than obvious they can do
>> so because the help string doesn't document that magic escape sequence,
>> nor does it document the *other* escape sequences supported by
>> grep-expand-template (which is also probably a bug).
>
> Yes, the doc string should contain all the possible expansions, but I'm
> not sure whether it should default to having <C>, since grep and lgrep
> default do different things.  And does git grep support --color, which
> will apparently also be inserted if you have <C>?
>
>  <C> - place to put the options like -i and --color.
>
> Weird system.

grep-expand-template adds the option -i on this condition:

  (and case-fold-search (isearch-no-upper-case-p regexp t))

It's very like when isearch turns into case-insensitive search
when the search string contains no upper-case letters.

BTW, often there is also need to add the option -w to match
whole words, but I have no idea how to enable this in grep templates.