aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Albinus2013-12-06 16:34:06 +0100
committerMichael Albinus2013-12-06 16:34:06 +0100
commit4803595dfd00ce07cd09913ee3c5d40a023f3a08 (patch)
tree5206084ae7db0df727e0f376536393d287899cc1
parenta59d76e05f20a25ecec8fc83834ba03c343ae4a2 (diff)
downloademacs-4803595dfd00ce07cd09913ee3c5d40a023f3a08.tar.gz
emacs-4803595dfd00ce07cd09913ee3c5d40a023f3a08.zip
Bug#16045
* progmodes/compile.el (compilation-start): * progmodes/grep.el (rgrep): Revert change of 2012-12-20T11:15:38Z!michael.albinus@gmx.de. * net/tramp-sh.el (tramp-sh-handle-start-file-process): Handle long command lines, lasting from "sh -c ...". (Bug#16045)
-rw-r--r--lisp/ChangeLog8
-rw-r--r--lisp/net/tramp-sh.el61
-rw-r--r--lisp/progmodes/compile.el6
-rw-r--r--lisp/progmodes/grep.el8
4 files changed, 52 insertions, 31 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 8e68eb40768..4bad667aa50 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,11 @@
12013-12-06 Michael Albinus <michael.albinus@gmx.de>
2
3 * progmodes/compile.el (compilation-start):
4 * progmodes/grep.el (rgrep): Revert change 2012-12-20T11:15:38Z!michael.albinus@gmx.de.
5
6 * net/tramp-sh.el (tramp-sh-handle-start-file-process):
7 Handle long command lines, lasting from "sh -c ...". (Bug#16045)
8
12013-12-06 Dmitry Gutov <dgutov@yandex.ru> 92013-12-06 Dmitry Gutov <dgutov@yandex.ru>
2 10
3 * progmodes/ruby-mode.el (ruby-syntax-propertize-function): Touch 11 * progmodes/ruby-mode.el (ruby-syntax-propertize-function): Touch
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index 6beece526ff..314c1a6f8e7 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -2686,27 +2686,46 @@ the result will be a local, non-Tramp, filename."
2686(defun tramp-sh-handle-start-file-process (name buffer program &rest args) 2686(defun tramp-sh-handle-start-file-process (name buffer program &rest args)
2687 "Like `start-file-process' for Tramp files." 2687 "Like `start-file-process' for Tramp files."
2688 (with-parsed-tramp-file-name default-directory nil 2688 (with-parsed-tramp-file-name default-directory nil
2689 ;; When PROGRAM is nil, we just provide a tty. 2689 (let* (;; When PROGRAM matches "*sh", and the first arg is "-c",
2690 (let ((command 2690 ;; it might be that the arguments exceed the command line
2691 (when (stringp program) 2691 ;; length. Therefore, we modify the command.
2692 (format "cd %s; exec env PS1=%s %s" 2692 (heredoc (and (stringp program)
2693 (tramp-shell-quote-argument localname) 2693 (string-match "sh$" program)
2694 ;; Use a human-friendly prompt, for example for `shell'. 2694 (string-equal "-c" (car args))
2695 (tramp-shell-quote-argument 2695 (= (length args) 2)))
2696 (format "%s %s" 2696 ;; When PROGRAM is nil, we just provide a tty.
2697 (file-remote-p default-directory) 2697 (args (if (not heredoc) args
2698 tramp-initial-end-of-output)) 2698 (let ((i 250))
2699 (mapconcat 'tramp-shell-quote-argument 2699 (while (and (< i (length (cadr args)))
2700 (cons program args) " ")))) 2700 (string-match " " (cadr args) i))
2701 (tramp-process-connection-type 2701 (setcdr
2702 (or (null program) tramp-process-connection-type)) 2702 args
2703 (bmp (and (buffer-live-p buffer) (buffer-modified-p buffer))) 2703 (list (replace-match " \\\\\n" nil nil (cadr args))))
2704 (name1 name) 2704 (setq i (+ i 250))))
2705 (i 0) 2705 (cdr args)))
2706 ;; We do not want to raise an error when 2706 (command
2707 ;; `start-file-process' has been started several time in 2707 (when (stringp program)
2708 ;; `eshell' and friends. 2708 (format "cd %s; exec %s env PS1=%s %s"
2709 (tramp-current-connection nil)) 2709 (tramp-shell-quote-argument localname)
2710 (if heredoc "<<EOF" "")
2711 ;; Use a human-friendly prompt, for example for `shell'.
2712 (tramp-shell-quote-argument
2713 (format "%s %s"
2714 (file-remote-p default-directory)
2715 tramp-initial-end-of-output))
2716 (if heredoc
2717 (format "%s\n%s\nEOF" program (car args))
2718 (mapconcat 'tramp-shell-quote-argument
2719 (cons program args) " ")))))
2720 (tramp-process-connection-type
2721 (or (null program) tramp-process-connection-type))
2722 (bmp (and (buffer-live-p buffer) (buffer-modified-p buffer)))
2723 (name1 name)
2724 (i 0)
2725 ;; We do not want to raise an error when
2726 ;; `start-file-process' has been started several time in
2727 ;; `eshell' and friends.
2728 (tramp-current-connection nil))
2710 2729
2711 (unless buffer 2730 (unless buffer
2712 ;; BUFFER can be nil. We use a temporary buffer. 2731 ;; BUFFER can be nil. We use a temporary buffer.
diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el
index 58325b26634..5689be49f61 100644
--- a/lisp/progmodes/compile.el
+++ b/lisp/progmodes/compile.el
@@ -1623,11 +1623,7 @@ Returns the compilation buffer created."
1623 (format "%s started at %s\n\n" 1623 (format "%s started at %s\n\n"
1624 mode-name 1624 mode-name
1625 (substring (current-time-string) 0 19)) 1625 (substring (current-time-string) 0 19))
1626 ;; The command could be split into several lines, see 1626 command "\n")
1627 ;; `rgrep' for example. We want to display it as one
1628 ;; line.
1629 (apply 'concat (split-string command (regexp-quote "\\\n") t))
1630 "\n")
1631 (setq thisdir default-directory)) 1627 (setq thisdir default-directory))
1632 (set-buffer-modified-p nil)) 1628 (set-buffer-modified-p nil))
1633 ;; Pop up the compilation buffer. 1629 ;; Pop up the compilation buffer.
diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el
index 46af51e1f97..e63e29df37d 100644
--- a/lisp/progmodes/grep.el
+++ b/lisp/progmodes/grep.el
@@ -995,8 +995,6 @@ to specify a command to run."
995 (compilation-start regexp 'grep-mode)) 995 (compilation-start regexp 'grep-mode))
996 (setq dir (file-name-as-directory (expand-file-name dir))) 996 (setq dir (file-name-as-directory (expand-file-name dir)))
997 (require 'find-dired) ; for `find-name-arg' 997 (require 'find-dired) ; for `find-name-arg'
998 ;; In Tramp, there could be problems if the command line is too
999 ;; long. We escape it, therefore.
1000 (let ((command (grep-expand-template 998 (let ((command (grep-expand-template
1001 grep-find-template 999 grep-find-template
1002 regexp 1000 regexp
@@ -1005,7 +1003,7 @@ to specify a command to run."
1005 (mapconcat 1003 (mapconcat
1006 #'shell-quote-argument 1004 #'shell-quote-argument
1007 (split-string files) 1005 (split-string files)
1008 (concat "\\\n" " -o " find-name-arg " ")) 1006 (concat " -o " find-name-arg " "))
1009 " " 1007 " "
1010 (shell-quote-argument ")")) 1008 (shell-quote-argument ")"))
1011 dir 1009 dir
@@ -1026,7 +1024,7 @@ to specify a command to run."
1026 (concat "*/" 1024 (concat "*/"
1027 (cdr ignore))))))) 1025 (cdr ignore)))))))
1028 grep-find-ignored-directories 1026 grep-find-ignored-directories
1029 "\\\n -o -path ") 1027 " -o -path ")
1030 " " 1028 " "
1031 (shell-quote-argument ")") 1029 (shell-quote-argument ")")
1032 " -prune -o ")) 1030 " -prune -o "))
@@ -1044,7 +1042,7 @@ to specify a command to run."
1044 (shell-quote-argument 1042 (shell-quote-argument
1045 (cdr ignore)))))) 1043 (cdr ignore))))))
1046 grep-find-ignored-files 1044 grep-find-ignored-files
1047 "\\\n -o -name ") 1045 " -o -name ")
1048 " " 1046 " "
1049 (shell-quote-argument ")") 1047 (shell-quote-argument ")")
1050 " -prune -o ")))))) 1048 " -prune -o "))))))