diff lisp/progmodes/grep.el @ 112238:4f72b1e43644

Merge from emacs-23 branch.
author Glenn Morris <rgm@gnu.org>
date Sat, 15 Jan 2011 12:03:38 -0800
parents 417b1e4d63cd
children ef719132ddfa
line wrap: on
line diff
--- a/lisp/progmodes/grep.el	Fri Jan 14 22:21:48 2011 -0500
+++ b/lisp/progmodes/grep.el	Sat Jan 15 12:03:38 2011 -0800
@@ -565,7 +565,10 @@
 	(unless grep-find-command
 	  (setq grep-find-command
 		(cond ((eq grep-find-use-xargs 'gnu)
-		       (format "%s . -type f -print0 | %s -0 -e %s"
+		       ;; Windows shells need the program file name
+		       ;; after the pipe symbol be quoted if they use
+		       ;; forward slashes as directory separators.
+		       (format "%s . -type f -print0 | \"%s\" -0 -e %s"
 			       find-program xargs-program grep-command))
 		      ((eq grep-find-use-xargs 'exec)
 		       (let ((cmd0 (format "%s . -type f -exec %s"
@@ -576,21 +579,21 @@
 				  (shell-quote-argument ";"))
 			  (1+ (length cmd0)))))
 		      (t
-		       (format "%s . -type f -print | %s %s"
+		       (format "%s . -type f -print | \"%s\" %s"
 			       find-program xargs-program grep-command)))))
 	(unless grep-find-template
 	  (setq grep-find-template
 		(let ((gcmd (format "%s <C> %s <R>"
 				    grep-program grep-options)))
 		  (cond ((eq grep-find-use-xargs 'gnu)
-			 (format "%s . <X> -type f <F> -print0 | %s -0 -e %s"
+			 (format "%s . <X> -type f <F> -print0 | \"%s\" -0 -e %s"
 				 find-program xargs-program gcmd))
 			((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 | %s %s"
+			 (format "%s . <X> -type f <F> -print | \"%s\" %s"
 				 find-program xargs-program gcmd))))))))
     (when (eq grep-highlight-matches 'auto-detect)
       (setq grep-highlight-matches