Commit 4803595d authored by Michael Albinus's avatar Michael Albinus
Browse files


* progmodes/compile.el (compilation-start):
* progmodes/grep.el (rgrep): Revert change of 2012-12-20T11:15:38Z!

* net/tramp-sh.el (tramp-sh-handle-start-file-process):
Handle long command lines, lasting from "sh -c ...".  (Bug#16045)
parent a59d76e0
2013-12-06 Michael Albinus <>
* progmodes/compile.el (compilation-start):
* progmodes/grep.el (rgrep): Revert change 2012-12-20T11:15:38Z!
* net/tramp-sh.el (tramp-sh-handle-start-file-process):
Handle long command lines, lasting from "sh -c ...". (Bug#16045)
2013-12-06 Dmitry Gutov <>
* progmodes/ruby-mode.el (ruby-syntax-propertize-function): Touch
......@@ -2686,18 +2686,37 @@ the result will be a local, non-Tramp, filename."
(defun tramp-sh-handle-start-file-process (name buffer program &rest args)
"Like `start-file-process' for Tramp files."
(with-parsed-tramp-file-name default-directory nil
(let* (;; When PROGRAM matches "*sh", and the first arg is "-c",
;; it might be that the arguments exceed the command line
;; length. Therefore, we modify the command.
(heredoc (and (stringp program)
(string-match "sh$" program)
(string-equal "-c" (car args))
(= (length args) 2)))
;; When PROGRAM is nil, we just provide a tty.
(let ((command
(args (if (not heredoc) args
(let ((i 250))
(while (and (< i (length (cadr args)))
(string-match " " (cadr args) i))
(list (replace-match " \\\\\n" nil nil (cadr args))))
(setq i (+ i 250))))
(cdr args)))
(when (stringp program)
(format "cd %s; exec env PS1=%s %s"
(format "cd %s; exec %s env PS1=%s %s"
(tramp-shell-quote-argument localname)
(if heredoc "<<EOF" "")
;; Use a human-friendly prompt, for example for `shell'.
(format "%s %s"
(file-remote-p default-directory)
(if heredoc
(format "%s\n%s\nEOF" program (car args))
(mapconcat 'tramp-shell-quote-argument
(cons program args) " "))))
(cons program args) " ")))))
(or (null program) tramp-process-connection-type))
(bmp (and (buffer-live-p buffer) (buffer-modified-p buffer)))
......@@ -1623,11 +1623,7 @@ Returns the compilation buffer created."
(format "%s started at %s\n\n"
(substring (current-time-string) 0 19))
;; 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))
command "\n")
(setq thisdir default-directory))
(set-buffer-modified-p nil))
;; Pop up the compilation buffer.
......@@ -995,8 +995,6 @@ 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
......@@ -1005,7 +1003,7 @@ to specify a command to run."
(split-string files)
(concat "\\\n" " -o " find-name-arg " "))
(concat " -o " find-name-arg " "))
" "
(shell-quote-argument ")"))
......@@ -1026,7 +1024,7 @@ to specify a command to run."
(concat "*/"
(cdr ignore)))))))
"\\\n -o -path ")
" -o -path ")
" "
(shell-quote-argument ")")
" -prune -o "))
......@@ -1044,7 +1042,7 @@ to specify a command to run."
(cdr ignore))))))
"\\\n -o -name ")
" -o -name ")
" "
(shell-quote-argument ")")
" -prune -o "))))))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment