From 90fd798aacbf92a330cf43d2670479499daf3fb1 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Sat, 9 Jan 2016 13:55:02 +0100 Subject: [PATCH] Fix coding system for Tramp on OS X. * lisp/net/tramp-compat.el: Require ucs-normalize. * lisp/net/tramp-sh.el (tramp-open-connection-setup-interactive-shell): Set coding system to `utf-8-hfs' for Mac OS X. * test/automated/tramp-tests.el (tramp-test29-vc-registered): Flush directory properties when needed. (tramp--test-utf8): Include Chinese file name, again. --- lisp/net/tramp-compat.el | 2 ++ lisp/net/tramp-sh.el | 14 +++++++++----- test/automated/tramp-tests.el | 7 +++++-- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/lisp/net/tramp-compat.el b/lisp/net/tramp-compat.el index c6de1837e9a..44923aee895 100644 --- a/lisp/net/tramp-compat.el +++ b/lisp/net/tramp-compat.el @@ -56,6 +56,8 @@ (require 'custom) (require 'format-spec) (require 'shell) + ;; Introduced in Emacs 23.2. + (require 'ucs-normalize nil 'noerror) (require 'trampver) (require 'tramp-loaddefs) diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index ca0707f5941..1357db0ac42 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -4214,10 +4214,8 @@ process to set up. VEC specifies the connection." (cons 'undecided 'undecided))) cs-decode cs-encode) (when (symbolp cs) (setq cs (cons cs cs))) - (setq cs-decode (car cs)) - (setq cs-encode (cdr cs)) - (unless cs-decode (setq cs-decode 'undecided)) - (unless cs-encode (setq cs-encode 'undecided)) + (setq cs-decode (or (car cs) 'undecided) + cs-encode (or (cdr cs) 'undecided)) (setq cs-encode (tramp-compat-coding-system-change-eol-conversion cs-encode @@ -4229,7 +4227,13 @@ process to set up. VEC specifies the connection." (when (search-forward "\r" nil t) (setq cs-decode (tramp-compat-coding-system-change-eol-conversion cs-decode 'dos))) - (tramp-compat-funcall + ;; Special setting for Mac OS X. + (when (and (string-match + "^Darwin" (tramp-get-connection-property vec "uname" "")) + (memq 'utf-8-hfs (coding-system-list))) + (setq cs-decode 'utf-8-hfs + cs-encode 'utf-8-hfs)) + (tramp-compat-funcall 'set-buffer-process-coding-system cs-decode cs-encode) (tramp-message vec 5 "Setting coding system to `%s' and `%s'" cs-decode cs-encode)) diff --git a/test/automated/tramp-tests.el b/test/automated/tramp-tests.el index 73a72946db4..c956f9cd008 100644 --- a/test/automated/tramp-tests.el +++ b/test/automated/tramp-tests.el @@ -1658,6 +1658,10 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." (vc-register nil (list (car vc-handled-backends) (list (file-name-nondirectory tmp-name2)))))) + ;; vc-git uses an own process sentinel, Tramp's sentinel + ;; for flushing the cache isn't used. + (with-parsed-tramp-file-name tmp-name1 nil + (tramp-flush-directory-property v localname)) (should (vc-registered (file-name-nondirectory tmp-name2))))) ;; Cleanup. @@ -2044,8 +2048,7 @@ Use the `ls' command." (unless (tramp--test-hpux-p) "Γυρίστε το Γαλαξία με Ώτο Στοπ") (unless (or (tramp--test-hpux-p) (tramp--test-darwin-p)) "أصبح بوسعك الآن تنزيل نسخة كاملة من موسوعة ويكيبيديا العربية لتصفحها بلا اتصال بالإنترنت") - (unless (tramp--test-darwin-p) - "银河系漫游指南系列") + "银河系漫游指南系列" "Автостопом по гала́ктике"))) (ert-deftest tramp-test32-utf8 () -- 2.11.4.GIT