emacs-devel
[Top][All Lists]
Advanced

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

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


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


Hi,

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?

Regards,
Tino
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
From 5220d4858475f0825c01926456a8932079e3d0d7 Mon Sep 17 00:00:00 2001
From: Tino Calancha <address@hidden>
Date: Sun, 18 Sep 2016 18:19:52 +0900
Subject: [PATCH] grep-compute-defaults: Ignore case if case-fold-search is
 non-nil

* lisp/progmodes/grep.el (grep-compute-defaults): Use option '-i'.
---
 lisp/progmodes/grep.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el
index f7f097b..ac871a1 100644
--- a/lisp/progmodes/grep.el
+++ b/lisp/progmodes/grep.el
@@ -590,7 +590,8 @@ grep-compute-defaults
     (unless (and grep-command grep-find-command
                 grep-template grep-find-template)
       (let ((grep-options
-            (concat (if grep-use-null-device "-n" "-nH")
+            (concat (if grep-use-null-device "-n"
+                       (if case-fold-search "-nHi" "-nH"))
                     (if (grep-probe grep-program
`(nil nil nil "-e" "foo" ,null-device)
                                     nil 1)
--
2.9.3

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;



reply via email to

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