aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Albinus2010-07-23 15:40:33 +0200
committerMichael Albinus2010-07-23 15:40:33 +0200
commit84bc68f28928824175ab4f3e3763e6b18868988e (patch)
treed25ae875f76adb3c1eba5eb0612ca3f82669e104
parent554d39beea35deab49eca961a3192f90e0ee61e0 (diff)
downloademacs-84bc68f28928824175ab4f3e3763e6b18868988e.tar.gz
emacs-84bc68f28928824175ab4f3e3763e6b18868988e.zip
* net/tramp.el (tramp-open-shell): New defun.
(tramp-find-shell, tramp-open-connection-setup-interactive-shell): Use it.
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/net/tramp.el58
2 files changed, 33 insertions, 31 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 7b1c419f55e..a4a0fa5c873 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,11 @@
12010-07-23 Michael Albinus <michael.albinus@gmx.de> 12010-07-23 Michael Albinus <michael.albinus@gmx.de>
2 2
3 * net/tramp.el (tramp-open-shell): New defun.
4 (tramp-find-shell, tramp-open-connection-setup-interactive-shell):
5 Use it.
6
72010-07-23 Michael Albinus <michael.albinus@gmx.de>
8
3 * net/tramp.el (tramp-file-name-regexp-unified) 9 * net/tramp.el (tramp-file-name-regexp-unified)
4 (tramp-completion-file-name-regexp-unified): On W32 systems, do 10 (tramp-completion-file-name-regexp-unified): On W32 systems, do
5 not regard the volume letter as remote filename. (Bug#5447) 11 not regard the volume letter as remote filename. (Bug#5447)
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 1e679c9262e..0afc4c95799 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -6598,7 +6598,29 @@ file exists and nonzero exit status otherwise."
6598 vec 'file-error "Couldn't find command to check if file exists")) 6598 vec 'file-error "Couldn't find command to check if file exists"))
6599 result)) 6599 result))
6600 6600
6601;; CCC test ksh or bash found for tilde expansion? 6601(defun tramp-open-shell (vec shell)
6602 "Opens shell SHELL."
6603 (with-progress-reporter vec 5 (format "Opening remote shell `%s'" shell)
6604 ;; Find arguments for this shell.
6605 (let ((tramp-end-of-output tramp-initial-end-of-output)
6606 (alist tramp-sh-extra-args)
6607 item extra-args)
6608 (while (and alist (null extra-args))
6609 (setq item (pop alist))
6610 (when (string-match (car item) shell)
6611 (setq extra-args (cdr item))))
6612 (when extra-args (setq shell (concat shell " " extra-args)))
6613 (tramp-send-command
6614 vec (format "exec env ENV='' PROMPT_COMMAND='' PS1=%s PS2='' PS3='' %s"
6615 (shell-quote-argument tramp-end-of-output) shell)
6616 t))
6617 ;; Setting prompts.
6618 (tramp-send-command
6619 vec (format "PS1=%s" (shell-quote-argument tramp-end-of-output)) t)
6620 (tramp-send-command vec "PS2=''" t)
6621 (tramp-send-command vec "PS3=''" t)
6622 (tramp-send-command vec "PROMPT_COMMAND=''" t)))
6623
6602(defun tramp-find-shell (vec) 6624(defun tramp-find-shell (vec)
6603 "Opens a shell on the remote host which groks tilde expansion." 6625 "Opens a shell on the remote host which groks tilde expansion."
6604 (unless (tramp-get-connection-property vec "remote-shell" nil) 6626 (unless (tramp-get-connection-property vec "remote-shell" nil)
@@ -6619,29 +6641,9 @@ file exists and nonzero exit status otherwise."
6619 (tramp-error 6641 (tramp-error
6620 vec 'file-error 6642 vec 'file-error
6621 "Couldn't find a shell which groks tilde expansion")) 6643 "Couldn't find a shell which groks tilde expansion"))
6622 ;; Find arguments for this shell.
6623 (let ((alist tramp-sh-extra-args)
6624 item extra-args)
6625 (while (and alist (null extra-args))
6626 (setq item (pop alist))
6627 (when (string-match (car item) shell)
6628 (setq extra-args (cdr item))))
6629 (when extra-args (setq shell (concat shell " " extra-args))))
6630 (tramp-message 6644 (tramp-message
6631 vec 5 "Starting remote shell `%s' for tilde expansion" shell) 6645 vec 5 "Starting remote shell `%s' for tilde expansion" shell)
6632 (let ((tramp-end-of-output tramp-initial-end-of-output)) 6646 (tramp-open-shell vec shell))
6633 (tramp-send-command
6634 vec
6635 (format "PROMPT_COMMAND='' PS1=%s PS2='' PS3='' exec %s"
6636 (shell-quote-argument tramp-end-of-output) shell)
6637 t))
6638 ;; Setting prompts.
6639 (with-progress-reporter vec 5 (format "Setting remote shell prompt")
6640 (tramp-send-command
6641 vec (format "PS1=%s" (shell-quote-argument tramp-end-of-output)) t)
6642 (tramp-send-command vec "PS2=''" t)
6643 (tramp-send-command vec "PS3=''" t)
6644 (tramp-send-command vec "PROMPT_COMMAND=''" t)))
6645 6647
6646 (t (tramp-message 6648 (t (tramp-message
6647 vec 5 "Remote `%s' groks tilde expansion, good" 6649 vec 5 "Remote `%s' groks tilde expansion, good"
@@ -6922,14 +6924,9 @@ process to set up. VEC specifies the connection."
6922 ;; way, we avoid the startup file clobbering $PS1. $PROMP_COMMAND 6924 ;; way, we avoid the startup file clobbering $PS1. $PROMP_COMMAND
6923 ;; is another way to set the prompt in /bin/bash, it must be 6925 ;; is another way to set the prompt in /bin/bash, it must be
6924 ;; discarded as well. 6926 ;; discarded as well.
6925 (tramp-send-command 6927 (tramp-open-shell
6926 vec 6928 vec
6927 (format 6929 (tramp-get-method-parameter (tramp-file-name-method vec) 'tramp-remote-sh))
6928 "exec env ENV='' PROMPT_COMMAND='' PS1=%s PS2='' PS3='' %s"
6929 (shell-quote-argument tramp-end-of-output)
6930 (tramp-get-method-parameter
6931 (tramp-file-name-method vec) 'tramp-remote-sh))
6932 t)
6933 6930
6934 ;; Disable echo. 6931 ;; Disable echo.
6935 (tramp-message vec 5 "Setting up remote shell environment") 6932 (tramp-message vec 5 "Setting up remote shell environment")
@@ -7045,7 +7042,7 @@ process to set up. VEC specifies the connection."
7045 ;; "echo $?" part if the "test" part has an error. In particular, 7042 ;; "echo $?" part if the "test" part has an error. In particular,
7046 ;; the OpenSolaris /bin/sh is a problem. There are also other 7043 ;; the OpenSolaris /bin/sh is a problem. There are also other
7047 ;; problems with /bin/sh of OpenSolaris, like redirection of stderr 7044 ;; problems with /bin/sh of OpenSolaris, like redirection of stderr
7048 ;; in in function declarations, or changing HISTFILE in place. 7045 ;; in function declarations, or changing HISTFILE in place.
7049 ;; Therefore, OpenSolaris' /bin/sh is replaced by bash, when 7046 ;; Therefore, OpenSolaris' /bin/sh is replaced by bash, when
7050 ;; detected. 7047 ;; detected.
7051 (tramp-find-shell vec) 7048 (tramp-find-shell vec)
@@ -8890,7 +8887,6 @@ Only works for Bourne-like shells."
8890;; likely to produce long command lines, and some shells choke on 8887;; likely to produce long command lines, and some shells choke on
8891;; long command lines. 8888;; long command lines.
8892;; * How to deal with MULE in `insert-file-contents' and `write-region'? 8889;; * How to deal with MULE in `insert-file-contents' and `write-region'?
8893;; * Test remote ksh or bash for tilde expansion in `tramp-find-shell'?
8894;; * abbreviate-file-name 8890;; * abbreviate-file-name
8895;; * Better error checking. At least whenever we see something 8891;; * Better error checking. At least whenever we see something
8896;; strange when doing zerop, we should kill the process and start 8892;; strange when doing zerop, we should kill the process and start