From a8a15d9d4529d9cc2ace1cbacf0828cb14c6de94 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Mon, 2 Dec 2013 14:52:23 +0100 Subject: [PATCH] * 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. --- lisp/ChangeLog | 7 +++++++ lisp/net/tramp-sh.el | 21 ++++++++++++++++++--- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index df576658697..5bb405e04c3 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,10 @@ +2013-12-02 Michael Albinus + + * 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 * subr.el (process-live-p): Return nil for non-process. (Bug#16023) diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 455ea1d4e9e..6beece526ff 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -419,8 +419,7 @@ as given in your `~/.profile'." ;;;###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 @@ process to set up. VEC specifies the connection." ;; 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 @@ Return ATTR." 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") -- 2.39.2