Three little fixes for igrep, two of them mine and one of them
Ville's.
--------------------------------------------------------------------------------
2002-11-06 Charles G Waldman <cgw(a)xemacs.org>
* igrep.el (igrep-case-fold-search): New variable.
(igrep): Append "-i" to options if igrep-case-fold-search is
true and expression is all lower-case.
Do not apply "shell-quote-argument" to directory names,
so that one can igrep through e.g. /usr/include/*/*.h.
(igrep-read-expression): Fix for xemacs-21.1 compatibility,
courtesy of Ville Skytta.
--- igrep/igrep.el.orig Mon Aug 12 22:41:40 2002
+++ igrep/igrep.el Wed Nov 6 11:51:21 2002
@@ -244,6 +244,11 @@
(put 'igrep-read-options 'variable-interactive
"XAlways prompt for options? (t or nil): ")
+(defvar igrep-case-fold-search t
+ "*If non-nil, `\\[igrep]' will ignore case when expression is all
lower-case.")
+(put 'igrep-case-fold-search 'variable-interactive
+ "XIgnore case? (t or nil): ")
+
(defvar igrep-read-multiple-files nil
"*If non-nil, `\\[igrep]' always prompts for multiple-files;
otherwise, it only prompts when 2 or 3 `C-u's are given as a prefix arg.")
@@ -500,7 +505,10 @@
(not (string-match "\\`z" program))))
(setq program (concat "z" program))
program)
- (or options "")
+ (or options (if (and igrep-case-fold-search
+ (equal expression (downcase expression)))
+ "-i")
+ "")
(or igrep-expression-option
(progn
(if (save-match-data
@@ -517,7 +525,8 @@
(if dir
(expand-file-name
(file-name-nondirectory file)
- (shell-quote-argument dir))
+ dir
+ )
file)))
files " "))
igrep-null-device)))
@@ -916,13 +925,14 @@
(format "Expression [default: %s]: "
default-expression)
"Expression: ")))
- (expression (cond ((featurep 'xemacs) ; incompatible
+ (expression (cond ((and (featurep 'xemacs) (emacs-version>= 21 4))
(read-from-minibuffer prompt
nil nil nil
'igrep-expression-history
nil ; ABBREV-TABLE
default-expression))
- ((>= emacs-major-version 20)
+ ((and (not (featurep 'xemacs))
+ (>= emacs-major-version 20))
(read-from-minibuffer prompt
nil nil nil
'igrep-expression-history