emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r118108: * net/tramp-sh.el (tramp-open-connection-se


From: Michael Albinus
Subject: [Emacs-diffs] trunk r118108: * net/tramp-sh.el (tramp-open-connection-setup-interactive-shell):
Date: Tue, 14 Oct 2014 11:59:29 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 118108
revision-id: address@hidden
parent: address@hidden
committer: Michael Albinus <address@hidden>
branch nick: trunk
timestamp: Tue 2014-10-14 13:59:16 +0200
message:
  * net/tramp-sh.el (tramp-open-connection-setup-interactive-shell):
  Reduce the amount of set environment variable commands.
modified:
  lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
  lisp/net/tramp-sh.el           trampsh.el-20100913133439-a1faifh29eqoi4nh-1
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2014-10-13 20:55:41 +0000
+++ b/lisp/ChangeLog    2014-10-14 11:59:16 +0000
@@ -1,3 +1,9 @@
+2014-10-14  Jérémy Compostella  <address@hidden>
+           Michael Albinus  <address@hidden>
+
+       * net/tramp-sh.el (tramp-open-connection-setup-interactive-shell):
+       Reduce the amount of set environment variable commands.
+
 2014-10-12  Fabián Ezequiel Gallina  <address@hidden>
 
        Fix import completion.  (Bug#18582)

=== modified file 'lisp/net/tramp-sh.el'
--- a/lisp/net/tramp-sh.el      2014-10-12 18:27:37 +0000
+++ b/lisp/net/tramp-sh.el      2014-10-14 11:59:16 +0000
@@ -3955,10 +3955,8 @@
 
   (tramp-message vec 5 "Setting shell prompt")
   (tramp-send-command
-   vec (format "PS1=%s" (tramp-shell-quote-argument tramp-end-of-output)) t)
-  (tramp-send-command vec "PS2=''" t)
-  (tramp-send-command vec "PS3=''" t)
-  (tramp-send-command vec "PROMPT_COMMAND=''" t)
+   vec (format "PS1=%s PS2='' PS3='' PROMPT_COMMAND=''"
+              (tramp-shell-quote-argument tramp-end-of-output)) t)
 
   ;; Try to set up the coding system correctly.
   ;; CCC this can't be the right way to do it.  Hm.
@@ -4078,15 +4076,22 @@
   (let ((env (append (when (tramp-get-remote-locale vec) ; Discard `(nil)'.
                       `(,(tramp-get-remote-locale vec)))
                     (copy-sequence tramp-remote-process-environment)))
-       unset item)
+       unset vars item)
     (while env
       (setq item (tramp-compat-split-string (car env) "="))
       (setcdr item (mapconcat 'identity (cdr item) "="))
       (if (and (stringp (cdr item)) (not (string-equal (cdr item) "")))
-         (tramp-send-command
-          vec (format "%s=%s; export %s" (car item) (cdr item) (car item)) t)
+         (push (format "%s %s" (car item) (cdr item)) vars)
        (push (car item) unset))
       (setq env (cdr env)))
+    (when vars
+      (tramp-send-command
+       vec
+       (format "while read var val; do export $var=$val; done <<'%s'\n%s\n%s"
+              tramp-end-of-heredoc
+              (mapconcat 'identity vars "\n")
+              tramp-end-of-heredoc)
+       t))
     (when unset
       (tramp-send-command
        vec (format "unset %s" (mapconcat 'identity unset " ")) t))))


reply via email to

[Prev in Thread] Current Thread [Next in Thread]