emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] trunk r115349: * net/tramp-sh.el (tramp-remote-process-env


From: Michael Albinus
Subject: [Emacs-diffs] trunk r115349: * net/tramp-sh.el (tramp-remote-process-environment): Do not set "LC_ALL".
Date: Mon, 02 Dec 2013 13:52:31 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 115349
revision-id: address@hidden
parent: address@hidden
committer: Michael Albinus <address@hidden>
branch nick: trunk
timestamp: Mon 2013-12-02 14:52:23 +0100
message:
  * net/tramp-sh.el (tramp-remote-process-environment): Do not set "LC_ALL".
  (tramp-get-remote-locale): New defun.
  (tramp-open-connection-setup-interactive-shell): Use it.
modified:
  lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
  lisp/net/tramp-sh.el           trampsh.el-20100913133439-a1faifh29eqoi4nh-1
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2013-12-02 07:13:01 +0000
+++ b/lisp/ChangeLog    2013-12-02 13:52:23 +0000
@@ -1,3 +1,10 @@
+2013-12-02  Michael Albinus  <address@hidden>
+
+       * net/tramp-sh.el (tramp-remote-process-environment): Do not set
+       "LC_ALL".
+       (tramp-get-remote-locale): New defun.
+       (tramp-open-connection-setup-interactive-shell): Use it.
+
 2013-12-02  Leo Liu  <address@hidden>
 
        * subr.el (process-live-p): Return nil for non-process.  (Bug#16023)

=== modified file 'lisp/net/tramp-sh.el'
--- a/lisp/net/tramp-sh.el      2013-11-26 15:07:10 +0000
+++ b/lisp/net/tramp-sh.el      2013-12-02 13:52:23 +0000
@@ -419,8 +419,7 @@
 
 ;;;###tramp-autoload
 (defcustom tramp-remote-process-environment
-  `("HISTFILE=$HOME/.tramp_history" "HISTSIZE=1" "TMOUT=0"
-    "LC_ALL=en_US.utf8" "LC_CTYPE=''"
+  `("HISTFILE=$HOME/.tramp_history" "HISTSIZE=1" "TMOUT=0" "LC_CTYPE=''"
     ,(format "TERM=%s" tramp-terminal-type)
     "EMACS=t" ;; Deprecated.
     ,(format "INSIDE_EMACS='%s,tramp:%s'" emacs-version tramp-version)
@@ -3889,7 +3888,8 @@
   ;; Set the environment.
   (tramp-message vec 5 "Setting default environment")
 
-  (let ((env (copy-sequence tramp-remote-process-environment))
+  (let ((env (append `(,(tramp-get-remote-locale vec))
+                    (copy-sequence tramp-remote-process-environment)))
        unset item)
     (while env
       (setq item (tramp-compat-split-string (car env) "="))
@@ -4827,6 +4827,21 @@
           x))
        remote-path)))))
 
+(defun tramp-get-remote-locale (vec)
+  (with-tramp-connection-property vec "locale"
+    (tramp-send-command vec "locale -a")
+    (let ((candidates '("en_US.utf8" "C.utf8" "C"))
+         locale)
+      (with-current-buffer (tramp-get-connection-buffer vec)
+       (while candidates
+         (goto-char (point-min))
+         (if (string-match (concat "^" (car candidates) "$") (buffer-string))
+             (setq locale (car candidates)
+                   candidates nil)
+           (setq candidates (cdr candidates)))))
+      ;; Return value.
+      (when locale (format "LC_ALL=%s" locale)))))
+
 (defun tramp-get-ls-command (vec)
   (with-tramp-connection-property vec "ls"
     (tramp-message vec 5 "Finding a suitable `ls' command")


reply via email to

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