* net/tramp-sh.el (tramp-open-shell): Cache the shell name.
authorMichael Albinus <michael.albinus@gmx.de>
Tue, 14 Aug 2012 14:48:28 +0000 (16:48 +0200)
committerMichael Albinus <michael.albinus@gmx.de>
Tue, 14 Aug 2012 14:48:28 +0000 (16:48 +0200)
(tramp-find-shell, tramp-open-connection-setup-interactive-shell):
Use cached shell name.

lisp/ChangeLog
lisp/net/tramp-sh.el

index fd442e1..5bd96d0 100644 (file)
@@ -1,3 +1,9 @@
+2012-08-14  Michael Albinus  <michael.albinus@gmx.de>
+
+       * net/tramp-sh.el (tramp-open-shell): Cache the shell name.
+       (tramp-find-shell, tramp-open-connection-setup-interactive-shell):
+       Use cached shell name.
+
 2012-08-14  Fabián Ezequiel Gallina  <fgallina@cuca>
 
        * progmodes/python.el (python-shell-send-string):
index a92f423..e757247 100644 (file)
@@ -3599,11 +3599,14 @@ file exists and nonzero exit status otherwise."
        (setq item (pop alist))
        (when (string-match (car item) shell)
          (setq extra-args (cdr item))))
-      (when extra-args (setq shell (concat shell " " extra-args)))
       (tramp-send-command
-       vec (format "exec env ENV='' PROMPT_COMMAND='' PS1=%s PS2='' PS3='' %s"
-                  (tramp-shell-quote-argument tramp-end-of-output) shell)
+       vec (format
+           "exec env ENV='' PROMPT_COMMAND='' PS1=%s PS2='' PS3='' %s %s"
+           (tramp-shell-quote-argument tramp-end-of-output)
+           shell (or extra-args ""))
        t))
+    (tramp-set-connection-property
+     (tramp-get-connection-process vec) "remote-shell" shell)
     ;; Setting prompts.
     (tramp-send-command
      vec (format "PS1=%s" (tramp-shell-quote-argument tramp-end-of-output)) t)
@@ -3614,8 +3617,12 @@ file exists and nonzero exit status otherwise."
 (defun tramp-find-shell (vec)
   "Opens a shell on the remote host which groks tilde expansion."
   (with-current-buffer (tramp-get-buffer vec)
-    (let ((default-shell (tramp-get-method-parameter
-                         (tramp-file-name-method vec) 'tramp-remote-shell))
+    (let ((default-shell
+           (or
+            (tramp-get-connection-property
+             (tramp-get-connection-process vec) "remote-shell" nil)
+            (tramp-get-method-parameter
+             (tramp-file-name-method vec) 'tramp-remote-shell)))
          shell)
       (setq shell
            (with-connection-property vec "remote-shell"
@@ -3692,8 +3699,9 @@ process to set up.  VEC specifies the connection."
     ;; discarded as well.
     (tramp-open-shell
      vec
-     (tramp-get-method-parameter
-      (tramp-file-name-method vec) 'tramp-remote-shell))
+     (or (tramp-get-connection-property vec "remote-shell" nil)
+        (tramp-get-method-parameter
+         (tramp-file-name-method vec) 'tramp-remote-shell)))
 
     ;; Disable echo.
     (tramp-message vec 5 "Setting up remote shell environment")