* progmodes/grep.el (rgrep): Escape command line. Sometimes, it
authorMichael Albinus <michael.albinus@gmx.de>
Thu, 20 Dec 2012 11:15:38 +0000 (12:15 +0100)
committerMichael Albinus <michael.albinus@gmx.de>
Thu, 20 Dec 2012 11:15:38 +0000 (12:15 +0100)
is too long for Tramp.  See discussion in
<http://thread.gmane.org/gmane.emacs.tramp/8233/focus=8244>.

* progmodes/compile.el (compilation-start): Remove line escape template.

lisp/ChangeLog
lisp/progmodes/compile.el
lisp/progmodes/grep.el

index c5ad40f..342308c 100644 (file)
@@ -1,3 +1,12 @@
+2012-12-20  Michael Albinus  <michael.albinus@gmx.de>
+
+       * progmodes/grep.el (rgrep): Escape command line.  Sometimes, it
+       is too long for Tramp.  See discussion in
+       <http://thread.gmane.org/gmane.emacs.tramp/8233/focus=8244>.
+
+       * progmodes/compile.el (compilation-start): Remove line escape
+       template.
+
 2012-12-20  Dmitry Antipov  <dmantipov@yandex.ru>
 
        * vc/ediff-ptch.el (ediff-map-patch-buffer): Use `point-min-marker'.
index 06525b3..1b70402 100644 (file)
@@ -1611,7 +1611,11 @@ Returns the compilation buffer created."
                (format "%s started at %s\n\n"
                        mode-name
                        (substring (current-time-string) 0 19))
-               command "\n")
+               ;; The command could be split into several lines, see
+               ;; `rgrep' for example.  We want to display it as one
+               ;; line.
+               (apply 'concat (split-string command (regexp-quote "\\\n") t))
+               "\n")
        (setq thisdir default-directory))
       (set-buffer-modified-p nil))
     ;; Pop up the compilation buffer.
index b448b7b..721c125 100644 (file)
@@ -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 "))))))