]> code.delx.au - gnu-emacs/blobdiff - lisp/progmodes/grep.el
Merge from emacs-24; up to 2012-12-06T01:39:03Z!monnier@iro.umontreal.ca
[gnu-emacs] / lisp / progmodes / grep.el
index c8a0dc449dfc2dac8dd2766211ea239e5dc2ab93..ef321addf2448c9e84c6da147f1d7ac27765d779 100644 (file)
@@ -586,7 +586,7 @@ This function is called from `compilation-filter-hook'."
                  'exec-plus)
                 ((and
                   (grep-probe find-program `(nil nil nil ,null-device "-print0"))
-                  (grep-probe xargs-program `(nil nil nil "-0" "-e" "echo")))
+                  (grep-probe xargs-program `(nil nil nil "-0" "echo")))
                  'gnu)
                 (t
                  'exec))))
@@ -596,7 +596,7 @@ This function is called from `compilation-filter-hook'."
                       ;; 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"
+                      (format "%s . -type f -print0 | \"%s\" -0 %s"
                               find-program xargs-program grep-command))
                      ((memq grep-find-use-xargs '(exec exec-plus))
                       (let ((cmd0 (format "%s . -type f -exec %s"
@@ -621,7 +621,7 @@ This function is called from `compilation-filter-hook'."
                                (format "%s " null-device)
                              "")))
                  (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 %s"
                                 find-program xargs-program gcmd))
                        ((eq grep-find-use-xargs 'exec)
                         (format "%s . <X> -type f <F> -exec %s {} %s%s"
@@ -992,14 +992,17 @@ to specify a command to run."
            (compilation-start regexp 'grep-mode))
       (setq dir (file-name-as-directory (expand-file-name dir)))
       (require 'find-dired)            ; for `find-name-arg'
+      ;; In Tramp, there could be problems if the command line is too
+      ;; long.  We escape it, therefore.
       (let ((command (grep-expand-template
                      grep-find-template
                      regexp
                      (concat (shell-quote-argument "(")
                              " " find-name-arg " "
-                             (mapconcat #'shell-quote-argument
-                                        (split-string files)
-                                        (concat " -o " find-name-arg " "))
+                             (mapconcat
+                              #'shell-quote-argument
+                              (split-string files)
+                              (concat "\\\n" " -o " find-name-arg " "))
                              " "
                              (shell-quote-argument ")"))
                      dir
@@ -1020,7 +1023,7 @@ to specify a command to run."
                                                      (concat "*/"
                                                              (cdr ignore)))))))
                                     grep-find-ignored-directories
-                                    " -o -path ")
+                                    "\\\n -o -path ")
                                    " "
                                    (shell-quote-argument ")")
                                    " -prune -o "))
@@ -1038,7 +1041,7 @@ to specify a command to run."
                                                     (shell-quote-argument
                                                      (cdr ignore))))))
                                     grep-find-ignored-files
-                                    " -o -name ")
+                                    "\\\n -o -name ")
                                    " "
                                    (shell-quote-argument ")")
                                    " -prune -o "))))))