aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Albinus2016-03-31 11:45:45 +0200
committerMichael Albinus2016-03-31 11:45:45 +0200
commitdf441b362c25c4ad59ea3d83137328d0d4098eaf (patch)
tree431b2dd5a66cf2e71d73a6d3549342b21228cbcc
parent22443312188ff097b69d9ff4b87c2b4f7bbbc263 (diff)
downloademacs-df441b362c25c4ad59ea3d83137328d0d4098eaf.tar.gz
emacs-df441b362c25c4ad59ea3d83137328d0d4098eaf.zip
Fix OS X specific settings in tramp-tests
* lisp/net/tramp-sh.el (tramp-maybe-open-connection): Use it. * lisp/net/tramp.el (tramp-get-local-locale): New defun. * test/automated/tramp-tests.el (tramp--test-darwin-p): Remove. (tramp--test-utf8): Improve settings of coding systems. Do not use `tramp--test-darwin-p' anymore. (Bug#22145)
-rw-r--r--lisp/net/tramp-sh.el4
-rw-r--r--lisp/net/tramp.el20
-rw-r--r--test/automated/tramp-tests.el22
3 files changed, 30 insertions, 16 deletions
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index 9fa46109a5a..5b9083203b5 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -2865,7 +2865,7 @@ This is like `dired-recursive-delete-directory' for Tramp files."
2865 (narrow-to-region (point) (point)) 2865 (narrow-to-region (point) (point))
2866 ;; We cannot use `insert-buffer-substring' because the Tramp 2866 ;; We cannot use `insert-buffer-substring' because the Tramp
2867 ;; buffer changes its contents before insertion due to calling 2867 ;; buffer changes its contents before insertion due to calling
2868 ;; `expand-file' and alike. 2868 ;; `expand-file-name' and alike.
2869 (insert 2869 (insert
2870 (with-current-buffer (tramp-get-buffer v) 2870 (with-current-buffer (tramp-get-buffer v)
2871 (buffer-string))) 2871 (buffer-string)))
@@ -4865,7 +4865,7 @@ connection if a previous connection has died for some reason."
4865 (when (and p (processp p)) 4865 (when (and p (processp p))
4866 (delete-process p)) 4866 (delete-process p))
4867 (setenv "TERM" tramp-terminal-type) 4867 (setenv "TERM" tramp-terminal-type)
4868 (setenv "LC_ALL" "en_US.utf8") 4868 (setenv "LC_ALL" (tramp-get-local-locale vec))
4869 (if (stringp tramp-histfile-override) 4869 (if (stringp tramp-histfile-override)
4870 (setenv "HISTFILE" tramp-histfile-override) 4870 (setenv "HISTFILE" tramp-histfile-override)
4871 (if tramp-histfile-override 4871 (if tramp-histfile-override
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 43962169d5a..19dced6c2f3 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -3939,6 +3939,26 @@ This is used internally by `tramp-file-mode-from-int'."
3939 (tramp-compat-funcall 'group-gid) 3939 (tramp-compat-funcall 'group-gid)
3940 (nth 3 (tramp-compat-file-attributes "~/" id-format)))) 3940 (nth 3 (tramp-compat-file-attributes "~/" id-format))))
3941 3941
3942(defun tramp-get-local-locale (&optional vec)
3943 ;; We use key nil for local connection properties.
3944 (with-tramp-connection-property nil "locale"
3945 (let ((candidates '("en_US.utf8" "C.utf8" "en_US.UTF-8"))
3946 locale)
3947 (with-temp-buffer
3948 (unless (or (memq system-type '(windows-nt))
3949 (not (zerop (tramp-call-process
3950 nil "locale" nil t nil "-a"))))
3951 (while candidates
3952 (goto-char (point-min))
3953 (if (string-match (format "^%s\r?$" (regexp-quote (car candidates)))
3954 (buffer-string))
3955 (setq locale (car candidates)
3956 candidates nil)
3957 (setq candidates (cdr candidates))))))
3958 ;; Return value.
3959 (when vec (tramp-message vec 7 "locale %s" (or locale "C")))
3960 (or locale "C"))))
3961
3942;;;###tramp-autoload 3962;;;###tramp-autoload
3943(defun tramp-check-cached-permissions (vec access) 3963(defun tramp-check-cached-permissions (vec access)
3944 "Check `file-attributes' caches for VEC. 3964 "Check `file-attributes' caches for VEC.
diff --git a/test/automated/tramp-tests.el b/test/automated/tramp-tests.el
index d9563ec9174..a12ee387576 100644
--- a/test/automated/tramp-tests.el
+++ b/test/automated/tramp-tests.el
@@ -1785,14 +1785,6 @@ Several special characters do not work properly there."
1785 (file-truename tramp-test-temporary-file-directory) nil 1785 (file-truename tramp-test-temporary-file-directory) nil
1786 (string-match "^HP-UX" (tramp-get-connection-property v "uname" "")))) 1786 (string-match "^HP-UX" (tramp-get-connection-property v "uname" ""))))
1787 1787
1788(defun tramp--test-darwin-p ()
1789 "Check, whether the remote host runs Mac OS X.
1790Several special characters do not work properly there."
1791 ;; We must refill the cache. `file-truename' does it.
1792 (with-parsed-tramp-file-name
1793 (file-truename tramp-test-temporary-file-directory) nil
1794 (string-match "^Darwin" (tramp-get-connection-property v "uname" ""))))
1795
1796(defun tramp--test-check-files (&rest files) 1788(defun tramp--test-check-files (&rest files)
1797 "Run a simple but comprehensive test over every file in FILES." 1789 "Run a simple but comprehensive test over every file in FILES."
1798 ;; We must use `file-truename' for the temporary directory, because 1790 ;; We must use `file-truename' for the temporary directory, because
@@ -2041,15 +2033,17 @@ Use the `ls' command."
2041 2033
2042(defun tramp--test-utf8 () 2034(defun tramp--test-utf8 ()
2043 "Perform the test in `tramp-test32-utf8*'." 2035 "Perform the test in `tramp-test32-utf8*'."
2044 (let ((coding-system-for-read 'utf-8) 2036 (let* ((utf8 (if (and (eq system-type 'darwin)
2045 (coding-system-for-write 'utf-8) 2037 (memq 'utf-8-hfs (coding-system-list)))
2046 (file-name-coding-system 'utf-8)) 2038 'utf-8-hfs 'utf-8))
2039 (coding-system-for-read utf8)
2040 (coding-system-for-write utf8)
2041 (file-name-coding-system utf8))
2047 (tramp--test-check-files 2042 (tramp--test-check-files
2048 (unless (tramp--test-hpux-p) "Γυρίστε το Γαλαξία με Ώτο Στοπ") 2043 (unless (tramp--test-hpux-p) "Γυρίστε το Γαλαξία με Ώτο Στοπ")
2049 (unless (or (tramp--test-hpux-p) (tramp--test-darwin-p)) 2044 (unless (tramp--test-hpux-p)
2050 "أصبح بوسعك الآن تنزيل نسخة كاملة من موسوعة ويكيبيديا العربية لتصفحها بلا اتصال بالإنترنت") 2045 "أصبح بوسعك الآن تنزيل نسخة كاملة من موسوعة ويكيبيديا العربية لتصفحها بلا اتصال بالإنترنت")
2051 (unless (tramp--test-darwin-p) 2046 "银河系漫游指南系列"
2052 "银河系漫游指南系列")
2053 "Автостопом по гала́ктике"))) 2047 "Автостопом по гала́ктике")))
2054 2048
2055(ert-deftest tramp-test32-utf8 () 2049(ert-deftest tramp-test32-utf8 ()