[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/lisp/progmodes/grep.el,v
From: |
Kim F. Storm |
Subject: |
[Emacs-diffs] Changes to emacs/lisp/progmodes/grep.el,v |
Date: |
Wed, 23 Aug 2006 23:23:03 +0000 |
CVSROOT: /cvsroot/emacs
Module name: emacs
Changes by: Kim F. Storm <kfstorm> 06/08/23 23:23:03
Index: grep.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/progmodes/grep.el,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -b -r1.65 -r1.66
--- grep.el 29 Jul 2006 02:03:21 -0000 1.65
+++ grep.el 23 Aug 2006 23:23:02 -0000 1.66
@@ -335,7 +335,7 @@
(defvar grep-find-use-xargs nil
"Whether \\[grep-find] uses the `xargs' utility by default.
-If nil, it uses `find -exec'; if `gnu', it uses `find -print0' and `xargs -0';
+If `exec', it uses `find -exec'; if `gnu', it uses `find -print0' and `xargs
-0';
if not nil and not `gnu', it uses `find -print' and `xargs'.
This variable's value takes effect when `grep-compute-defaults' is called.")
@@ -419,21 +419,29 @@
(format "%s <C> %s <R> <F>" grep-program grep-options)))
(unless grep-find-use-xargs
(setq grep-find-use-xargs
- (if (and
+ (cond
+ ((and
(grep-probe find-program `(nil nil nil ,null-device
"-print0"))
(grep-probe "xargs" `(nil nil nil "-0" "-e" "echo")))
- 'gnu)))
+ 'gnu)
+ (t
+ 'exec))))
(unless grep-find-command
(setq grep-find-command
(cond ((eq grep-find-use-xargs 'gnu)
(format "%s . -type f -print0 | xargs -0 -e %s"
find-program grep-command))
- (grep-find-use-xargs
+ ((eq grep-find-use-xargs 'exec)
+ (let ((cmd0 (format "%s . -type f -exec %s"
+ find-program grep-command)))
+ (cons
+ (format "%s {} %s %s"
+ cmd0 null-device
+ (shell-quote-argument ";"))
+ (1+ (length cmd0)))))
+ (t
(format "%s . -type f -print | xargs %s"
- find-program grep-command))
- (t (cons (format "%s . -type f -exec %s {} %s \\;"
- find-program grep-command null-device)
- (+ 22 (length grep-command)))))))
+ find-program grep-command)))))
(unless grep-find-template
(setq grep-find-template
(let ((gcmd (format "%s <C> %s <R>"
@@ -441,11 +449,13 @@
(cond ((eq grep-find-use-xargs 'gnu)
(format "%s . <X> -type f <F> -print0 | xargs -0 -e %s"
find-program gcmd))
- (grep-find-use-xargs
+ ((eq grep-find-use-xargs 'exec)
+ (format "%s . <X> -type f <F> -exec %s {} %s %s"
+ find-program gcmd null-device
+ (shell-quote-argument ";")))
+ (t
(format "%s . <X> -type f <F> -print | xargs %s"
- find-program gcmd))
- (t (format "%s . <X> -type f <F> -exec %s {} %s \\;"
- find-program gcmd null-device))))))))
+ find-program gcmd))))))))
(unless (or (not grep-highlight-matches) (eq grep-highlight-matches t))
(setq grep-highlight-matches
(with-temp-buffer
@@ -736,18 +746,26 @@
(let ((command (grep-expand-template
grep-find-template
regexp
- (concat "\\( -name "
+ (concat (shell-quote-argument "(")
+ " -name "
(mapconcat #'shell-quote-argument
(split-string files)
" -o -name ")
- " \\)")
+ " "
+ (shell-quote-argument ")"))
dir
(and grep-find-ignored-directories
- (concat "\\( -path '*/"
- (mapconcat #'identity
+ (concat (shell-quote-argument "(")
+ ;; we should use shell-quote-argument here
+ " -path "
+ (mapconcat #'(lambda (dir)
+ (shell-quote-argument
+ (concat "*/" dir)))
grep-find-ignored-directories
- "' -o -path '*/")
- "' \\) -prune -o ")))))
+ " -o -path ")
+ " "
+ (shell-quote-argument ")")
+ " -prune -o ")))))
(when command
(if current-prefix-arg
(setq command
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] Changes to emacs/lisp/progmodes/grep.el,v,
Kim F. Storm <=