[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: grep-command: Ignore case if case-fold-search is non-nil

From: Tino Calancha
Subject: Re: grep-command: Ignore case if case-fold-search is non-nil
Date: Sun, 18 Sep 2016 20:09:03 +0900 (JST)
User-agent: Alpine 2.20 (DEB 67 2015-01-07)

On Sun, 18 Sep 2016, Richard Copley wrote:

On 18 September 2016 at 11:30, Tino Calancha <address@hidden> wrote:

On Sun, 18 Sep 2016, Dmitry Gutov wrote:

On 18.09.2016 12:31, Tino Calancha wrote:

Do you think `grep-compute-defaults' should add '-i', i.e., ignore case,
in the default `grep-command' when `case-fold-search' is non-nil?
Option '-i' is specified by POSIX, do we need to check if `grep-program'
support it?

grep-options is used in both grep-template and grep-find-template.

And they both get "-i" inserted into later, in grep-expand-template.

Thank you.
Tha's right: `rgrep' and `lgrep' default to case _insensitive_ search; but
`grep-find' defaults to case _sensitive_ search.

emacs -Q
M-: (dired (concat source-directory "/lisp")) RET
M-x: lgrep RET undid RET replace.el RET RET
;; Found a match (same for rgrep)
M-x: grep-find RET
;; show a case sensitive default command as follows:
find . -type f -exec grep --color -nH -e  \{\} +

I would suggest to be instead:
find . -type f -exec grep --color -nHi -e  \{\} +

that would be consistent with defaults for `rgrep' and `lgrep'.
What do you think?

Hi Richard,
What if the user toggles case-fold-search between invocations of
grep-find? Will the argument be updated?

If not, and if the user doesn't know about `grep-compute-defaults' (an
undocumented non-interactive function) then the argument depends on
the state of case-fold-search at the time of the first use of
grep-find, which seems awkward.
AFICT, if the user changes case-fold-search, `rgrep' and `lgrep' will follow that change, but `grep-find' seems keep unchanged.
I guess the behaviour of `grep-find' should be similar as the other
2 commands.  Then, if a user want to keep his/her `grep-command' constant,
s?he just need to customize it.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]