From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Richard Copley Newsgroups: gmane.emacs.devel Subject: Re: grep-command: Ignore case if case-fold-search is non-nil Date: Sun, 18 Sep 2016 11:52:07 +0100 Message-ID: References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: blaine.gmane.org 1474196051 15141 195.159.176.226 (18 Sep 2016 10:54:11 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 18 Sep 2016 10:54:11 +0000 (UTC) Cc: Emacs developers , Dmitry Gutov To: Tino Calancha Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Sep 18 12:54:06 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1blZjY-00031p-7P for ged-emacs-devel@m.gmane.org; Sun, 18 Sep 2016 12:54:04 +0200 Original-Received: from localhost ([::1]:49485 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1blZjW-0002Bg-Gl for ged-emacs-devel@m.gmane.org; Sun, 18 Sep 2016 06:54:02 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:55581) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1blZiC-0001mF-E9 for emacs-devel@gnu.org; Sun, 18 Sep 2016 06:52:41 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1blZiA-0000x1-Fn for emacs-devel@gnu.org; Sun, 18 Sep 2016 06:52:39 -0400 Original-Received: from mail-vk0-x230.google.com ([2607:f8b0:400c:c05::230]:36704) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1blZiA-0000ws-BF for emacs-devel@gnu.org; Sun, 18 Sep 2016 06:52:38 -0400 Original-Received: by mail-vk0-x230.google.com with SMTP id m62so87488990vkd.3 for ; Sun, 18 Sep 2016 03:52:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=N9eeLWEfigNsLoMjnze5nPArcE/YYoTU45HMVlTjbG8=; b=tB6F6OagdoOKtomSRlBCcVSradNW9PrzuGaxuouWO1Tno83lQ8VtAhb0fvlF4xr8U1 X1jvcmh2HC6K66RfSOWJBqwTOF1fAcHWpgKGvJmoD08PVZg17uA0Tt4em3o67AkkVhSI WxI7zhF4uRH+USIKsqCTbkl1WuasZzr+D+XE3Pl3tCYtjGKe/PGaKeaSBqlbY40+MgFU n31KH6ZG9wRsqDmlkDv872XmiYleWrOQx1T5mjHnvLLiWdko6P7prIlRzkAG9RzdAwXV RnmAya54jH7OA+VpBNXpmHciSI/Rvn+HdZtOWeWYCfysujXwHM+fz1Uy2o7cNX0bI6fk XVbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=N9eeLWEfigNsLoMjnze5nPArcE/YYoTU45HMVlTjbG8=; b=B2EmatK4B5foCkE+BkGhSahaqzF83XwrMZuXZLnvdNhT49TLrR4z9UarTR9/DGkNIt HiQ23VAJvdiMPj/VZDTXmwAzx6RSaCDOhZrBMDHzok+RcGkjYxSNdFu3JipXHLej6xoA OhvDBIWIo5L/dNajwX39VJj+fOQ0hZxznXmA+8aajLO7HRf/wZRFALMuPzVAs/PGzgV2 bIg3vnL1r1xRf61R24qem0PU0vjHaD7GjBgr+Rptj+IiyEuQB/7PJkUiRIL02gJepoCZ gWCEHzi9dI25yLEPlrtiCrLEGXTh7gHEdB5wcgrTNegICMMiVGVmyKZn/0bWD6cAo1pU 5sdQ== X-Gm-Message-State: AE9vXwPvfv3Bw1ghDPBO0Fm10CxcqrPXnOphrEuccxzgK+qyN0yuBETuPR7mB8bgf/RSuX9gm3QyL6ojjrnDcw== X-Received: by 10.31.8.80 with SMTP id 77mr10810565vki.154.1474195957840; Sun, 18 Sep 2016 03:52:37 -0700 (PDT) Original-Received: by 10.176.82.176 with HTTP; Sun, 18 Sep 2016 03:52:07 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:400c:c05::230 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:207536 Archived-At: On 18 September 2016 at 11:30, Tino Calancha 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? Thanks.