*************** *** 1433,1441 **** ;;; Internal Variables: (defvar tramp-end-of-output ! (concat ! "///" (md5 (concat ! (prin1-to-string process-environment) (current-time-string)))) "String used to recognize end of output.") (defvar tramp-current-method nil --- 1433,1443 ---- ;;; Internal Variables: (defvar tramp-end-of-output ! (format ! "%s///%s%s" ! tramp-rsh-end-of-line ! (md5 (concat (prin1-to-string process-environment) (current-time-string))) ! tramp-rsh-end-of-line) "String used to recognize end of output.") (defvar tramp-current-method nil *************** *** 5360,5381 **** vec (format "PROMPT_COMMAND='' PS1='$ ' PS2='' PS3='' exec %s" shell) t)) (tramp-message vec 5 "Setting remote shell prompt...") ! ;; Douglas Gray Stephens says that we ! ;; must use "\n" here, not tramp-rsh-end-of-line. Kai left the ! ;; last tramp-rsh-end-of-line, Douglas wanted to replace that, ! ;; as well. ! (tramp-send-command ! vec ! (format "PS1='%s%s%s'" ! tramp-rsh-end-of-line ! tramp-end-of-output ! tramp-rsh-end-of-line) ! t) (tramp-send-command vec "PS2=''" t) (tramp-send-command vec "PS3=''" t) (tramp-send-command vec "PROMPT_COMMAND=''" t) (tramp-message vec 5 "Setting remote shell prompt...done")) (t (tramp-message vec 5 "Remote `%s' groks tilde expansion, good" (tramp-get-method-parameter --- 5362,5375 ---- vec (format "PROMPT_COMMAND='' PS1='$ ' PS2='' PS3='' exec %s" shell) t)) + ;; Setting prompts. (tramp-message vec 5 "Setting remote shell prompt...") ! (tramp-send-command vec (format "PS1='%s'" tramp-end-of-output) t) (tramp-send-command vec "PS2=''" t) (tramp-send-command vec "PS3=''" t) (tramp-send-command vec "PROMPT_COMMAND=''" t) (tramp-message vec 5 "Setting remote shell prompt...done")) + (t (tramp-message vec 5 "Remote `%s' groks tilde expansion, good" (tramp-get-method-parameter *************** *** 5668,5680 **** ;; We can set $PS1 to `tramp-end-of-output' only when the echo has ;; been disabled. Otherwise, the echo of the command would be ;; regarded as prompt already. ! (tramp-send-command ! vec ! (format "PS1='%s%s%s'" ! tramp-rsh-end-of-line ! tramp-end-of-output ! tramp-rsh-end-of-line) ! t) (tramp-send-command vec "PS2=''" t) (tramp-send-command vec "PS3=''" t) (tramp-send-command vec "PROMPT_COMMAND=''" t) --- 5662,5668 ---- ;; We can set $PS1 to `tramp-end-of-output' only when the echo has ;; been disabled. Otherwise, the echo of the command would be ;; regarded as prompt already. ! (tramp-send-command vec (format "PS1='%s'" tramp-end-of-output) t) (tramp-send-command vec "PS2=''" t) (tramp-send-command vec "PS3=''" t) (tramp-send-command vec "PROMPT_COMMAND=''" t) *************** *** 6249,6255 **** (with-current-buffer (process-buffer proc) ;; Initially, `tramp-end-of-output' is "$ ". There might be ;; leading escape sequences, which must be ignored. ! (let* ((regexp (format "^[^$\n]*%s\r?$" (regexp-quote tramp-end-of-output))) (found (tramp-wait-for-regexp proc timeout regexp))) (if found (let (buffer-read-only) --- 6237,6247 ---- (with-current-buffer (process-buffer proc) ;; Initially, `tramp-end-of-output' is "$ ". There might be ;; leading escape sequences, which must be ignored. ! (let* ((regexp ! (if (string-match (regexp-quote "\n") tramp-end-of-output) ! (mapconcat ! 'identity (split-string tramp-end-of-output "\n") "\r?\n") ! (format "^[^$\n]*%s\r?$" (regexp-quote tramp-end-of-output)))) (found (tramp-wait-for-regexp proc timeout regexp))) (if found (let (buffer-read-only) *************** *** 6833,6840 **** vec (format "( %s / -nt / )" (tramp-get-test-command vec))) (with-current-buffer (tramp-get-buffer vec) (goto-char (point-min)) ! (when (looking-at ! (format "\n%s\r?\n" (regexp-quote tramp-end-of-output))) (format "%s %%s -nt %%s" (tramp-get-test-command vec))))) (progn (tramp-send-command --- 6825,6831 ---- vec (format "( %s / -nt / )" (tramp-get-test-command vec))) (with-current-buffer (tramp-get-buffer vec) (goto-char (point-min)) ! (when (looking-at (regexp-quote tramp-end-of-output)) (format "%s %%s -nt %%s" (tramp-get-test-command vec))))) (progn (tramp-send-command