aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Albinus2014-10-14 13:59:16 +0200
committerMichael Albinus2014-10-14 13:59:16 +0200
commit5fa75d8eba2d43408fd7831dcfd69c21e31c21f3 (patch)
tree62618416aebb2bd88d7ed88868a3d1c1f327a17c
parent3f8c645caa36526f0160776617840bc6201b9f22 (diff)
downloademacs-5fa75d8eba2d43408fd7831dcfd69c21e31c21f3.tar.gz
emacs-5fa75d8eba2d43408fd7831dcfd69c21e31c21f3.zip
* net/tramp-sh.el (tramp-open-connection-setup-interactive-shell):
Reduce the amount of set environment variable commands.
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/net/tramp-sh.el19
2 files changed, 18 insertions, 7 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 41c68d7fbee..055ec17160e 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
12014-10-14 Jérémy Compostella <jeremy.compostella@intel.com>
2 Michael Albinus <michael.albinus@gmx.de>
3
4 * net/tramp-sh.el (tramp-open-connection-setup-interactive-shell):
5 Reduce the amount of set environment variable commands.
6
12014-10-12 Fabián Ezequiel Gallina <fgallina@gnu.org> 72014-10-12 Fabián Ezequiel Gallina <fgallina@gnu.org>
2 8
3 Fix import completion. (Bug#18582) 9 Fix import completion. (Bug#18582)
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index 65b64233e5c..ce5e2faff50 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -3955,10 +3955,8 @@ process to set up. VEC specifies the connection."
3955 3955
3956 (tramp-message vec 5 "Setting shell prompt") 3956 (tramp-message vec 5 "Setting shell prompt")
3957 (tramp-send-command 3957 (tramp-send-command
3958 vec (format "PS1=%s" (tramp-shell-quote-argument tramp-end-of-output)) t) 3958 vec (format "PS1=%s PS2='' PS3='' PROMPT_COMMAND=''"
3959 (tramp-send-command vec "PS2=''" t) 3959 (tramp-shell-quote-argument tramp-end-of-output)) t)
3960 (tramp-send-command vec "PS3=''" t)
3961 (tramp-send-command vec "PROMPT_COMMAND=''" t)
3962 3960
3963 ;; Try to set up the coding system correctly. 3961 ;; Try to set up the coding system correctly.
3964 ;; CCC this can't be the right way to do it. Hm. 3962 ;; CCC this can't be the right way to do it. Hm.
@@ -4078,15 +4076,22 @@ process to set up. VEC specifies the connection."
4078 (let ((env (append (when (tramp-get-remote-locale vec) ; Discard `(nil)'. 4076 (let ((env (append (when (tramp-get-remote-locale vec) ; Discard `(nil)'.
4079 `(,(tramp-get-remote-locale vec))) 4077 `(,(tramp-get-remote-locale vec)))
4080 (copy-sequence tramp-remote-process-environment))) 4078 (copy-sequence tramp-remote-process-environment)))
4081 unset item) 4079 unset vars item)
4082 (while env 4080 (while env
4083 (setq item (tramp-compat-split-string (car env) "=")) 4081 (setq item (tramp-compat-split-string (car env) "="))
4084 (setcdr item (mapconcat 'identity (cdr item) "=")) 4082 (setcdr item (mapconcat 'identity (cdr item) "="))
4085 (if (and (stringp (cdr item)) (not (string-equal (cdr item) ""))) 4083 (if (and (stringp (cdr item)) (not (string-equal (cdr item) "")))
4086 (tramp-send-command 4084 (push (format "%s %s" (car item) (cdr item)) vars)
4087 vec (format "%s=%s; export %s" (car item) (cdr item) (car item)) t)
4088 (push (car item) unset)) 4085 (push (car item) unset))
4089 (setq env (cdr env))) 4086 (setq env (cdr env)))
4087 (when vars
4088 (tramp-send-command
4089 vec
4090 (format "while read var val; do export $var=$val; done <<'%s'\n%s\n%s"
4091 tramp-end-of-heredoc
4092 (mapconcat 'identity vars "\n")
4093 tramp-end-of-heredoc)
4094 t))
4090 (when unset 4095 (when unset
4091 (tramp-send-command 4096 (tramp-send-command
4092 vec (format "unset %s" (mapconcat 'identity unset " ")) t)))) 4097 vec (format "unset %s" (mapconcat 'identity unset " ")) t))))