[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: Richard Copley
Subject: Re: grep-command: Ignore case if case-fold-search is non-nil
Date: Sun, 18 Sep 2016 11:52:07 +0100

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?

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.

If so, on the other hand, doesn't that turn toggle-case-fold-search
into quite a heavyweight operation?

Or what am I missing?

reply via email to

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