aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Albinus2014-11-20 20:10:15 +0100
committerMichael Albinus2014-11-20 20:10:15 +0100
commit6ec5ee8872bfb8b0ebc53d98fcb8f284e08c147f (patch)
tree0a1e5f3532df75a538ff08b13d29248a3bf8e88d
parentcd2e816cd3ebf562c680ed15b53cf2a88a01f14f (diff)
downloademacs-6ec5ee8872bfb8b0ebc53d98fcb8f284e08c147f.tar.gz
emacs-6ec5ee8872bfb8b0ebc53d98fcb8f284e08c147f.zip
Improve XEmacs compatibility.
* net/tramp.el (tramp-autoload-file-name-handler): Wrap `temporary-file-directory' by `symbol-value', it doesn't exist in XEmacs. (tramp-read-passwd): Don't use `with-timeout-suspend' and `with-timeout-unsuspend' if they don't exist, like in XEmacs. (tramp-time-less-p, tramp-time-subtract): Remove functions. (tramp-handle-file-newer-than-file-p, tramp-time-diff): * net/ttramp-adb.el (tramp-adb-ls-output-time-less-p): * net/ttramp-cache.el (tramp-get-file-property): * net/ttramp-smb.el (tramp-smb-handle-insert-directory): Use `time-less-p' and `time-subtract, respectively.
-rw-r--r--lisp/ChangeLog23
-rw-r--r--lisp/net/tramp-adb.el3
-rw-r--r--lisp/net/tramp-cache.el2
-rw-r--r--lisp/net/tramp-compat.el3
-rw-r--r--lisp/net/tramp-sh.el7
-rw-r--r--lisp/net/tramp-smb.el5
-rw-r--r--lisp/net/tramp.el37
7 files changed, 43 insertions, 37 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 306882eaca9..164d8c15492 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,26 @@
12014-11-20 Michael Albinus <michael.albinus@gmx.de>
2
3 Improve XEmacs compatibility.
4
5 * net/tramp.el (tramp-autoload-file-name-handler):
6 Wrap `temporary-file-directory' by `symbol-value', it doesn't
7 exist in XEmacs.
8 (tramp-read-passwd): Don't use `with-timeout-suspend' and
9 `with-timeout-unsuspend' if they don't exist, like in XEmacs.
10 (tramp-time-less-p, tramp-time-subtract): Remove functions.
11 (tramp-handle-file-newer-than-file-p, tramp-time-diff):
12 * net/ttramp-adb.el (tramp-adb-ls-output-time-less-p):
13 * net/ttramp-cache.el (tramp-get-file-property):
14 * net/ttramp-smb.el (tramp-smb-handle-insert-directory):
15 Use `time-less-p' and `time-subtract, respectively.
16
17 * net/ttramp-adb.el (top): Do not require time-date.el.
18
19 * net/ttramp-compat.el (top): Require time-date.el for XEmacs.
20
21 * net/ttramp-sh.el (tramp-open-connection-setup-interactive-shell):
22 Check, whether `utf-8' is a valid coding system.
23
12014-11-19 Eli Zaretskii <eliz@gnu.org> 242014-11-19 Eli Zaretskii <eliz@gnu.org>
2 25
3 * vc/vc.el (vc-retrieve-tag): Doc fix. 26 * vc/vc.el (vc-retrieve-tag): Doc fix.
diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el
index 2401b4af479..1695631d1ae 100644
--- a/lisp/net/tramp-adb.el
+++ b/lisp/net/tramp-adb.el
@@ -34,7 +34,6 @@
34;;; Code: 34;;; Code:
35 35
36(require 'tramp) 36(require 'tramp)
37(require 'time-date)
38 37
39;; Pacify byte-compiler. 38;; Pacify byte-compiler.
40(defvar directory-sep-char) 39(defvar directory-sep-char)
@@ -468,7 +467,7 @@ Emacs dired can't find files."
468 (setq time-a (apply 'encode-time (parse-time-string (match-string 0 a)))) 467 (setq time-a (apply 'encode-time (parse-time-string (match-string 0 a))))
469 (string-match tramp-adb-ls-date-regexp b) 468 (string-match tramp-adb-ls-date-regexp b)
470 (setq time-b (apply 'encode-time (parse-time-string (match-string 0 b)))) 469 (setq time-b (apply 'encode-time (parse-time-string (match-string 0 b))))
471 (tramp-time-less-p time-b time-a))) 470 (time-less-p time-b time-a)))
472 471
473(defun tramp-adb-ls-output-name-less-p (a b) 472(defun tramp-adb-ls-output-name-less-p (a b)
474 "Sort \"ls\" output by name, ascending." 473 "Sort \"ls\" output by name, ascending."
diff --git a/lisp/net/tramp-cache.el b/lisp/net/tramp-cache.el
index a6b7500433b..50c8e249fe3 100644
--- a/lisp/net/tramp-cache.el
+++ b/lisp/net/tramp-cache.el
@@ -136,7 +136,7 @@ Returns DEFAULT if not set."
136 (tramp-time-diff (current-time) (car value)) 136 (tramp-time-diff (current-time) (car value))
137 remote-file-name-inhibit-cache)) 137 remote-file-name-inhibit-cache))
138 (and (consp remote-file-name-inhibit-cache) 138 (and (consp remote-file-name-inhibit-cache)
139 (tramp-time-less-p 139 (time-less-p
140 remote-file-name-inhibit-cache (car value))))) 140 remote-file-name-inhibit-cache (car value)))))
141 (setq value (cdr value)) 141 (setq value (cdr value))
142 (setq value default)) 142 (setq value default))
diff --git a/lisp/net/tramp-compat.el b/lisp/net/tramp-compat.el
index cd336ec61b3..de63d8c7c7a 100644
--- a/lisp/net/tramp-compat.el
+++ b/lisp/net/tramp-compat.el
@@ -44,7 +44,8 @@
44 (require 'outline) 44 (require 'outline)
45 (require 'passwd) 45 (require 'passwd)
46 (require 'pp) 46 (require 'pp)
47 (require 'regexp-opt)) 47 (require 'regexp-opt)
48 (require 'time-date))
48 49
49 (require 'advice) 50 (require 'advice)
50 (require 'custom) 51 (require 'custom)
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index 6e46df254b2..21ec741d398 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -3971,9 +3971,10 @@ process to set up. VEC specifies the connection."
3971 (if (featurep 'mule) 3971 (if (featurep 'mule)
3972 ;; Use MULE to select the right EOL convention for communicating 3972 ;; Use MULE to select the right EOL convention for communicating
3973 ;; with the process. 3973 ;; with the process.
3974 (let ((cs (or (when (string-match 3974 (let ((cs (or (and (memq 'utf-8 (coding-system-list))
3975 "utf8" (or (tramp-get-remote-locale vec) "")) 3975 (string-match
3976 (cons 'utf-8 'utf-8)) 3976 "utf8" (or (tramp-get-remote-locale vec) ""))
3977 (cons 'utf-8 'utf-8))
3977 (tramp-compat-funcall 'process-coding-system proc) 3978 (tramp-compat-funcall 'process-coding-system proc)
3978 (cons 'undecided 'undecided))) 3979 (cons 'undecided 'undecided)))
3979 cs-decode cs-encode) 3980 cs-decode cs-encode)
diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el
index 15ae9ed6fa8..3d48f47e58e 100644
--- a/lisp/net/tramp-smb.el
+++ b/lisp/net/tramp-smb.el
@@ -976,7 +976,7 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored."
976 (lambda (x y) 976 (lambda (x y)
977 (if (string-match "t" switches) 977 (if (string-match "t" switches)
978 ;; Sort by date. 978 ;; Sort by date.
979 (tramp-time-less-p (nth 3 y) (nth 3 x)) 979 (time-less-p (nth 3 y) (nth 3 x))
980 ;; Sort by name. 980 ;; Sort by name.
981 (string-lessp (nth 0 x) (nth 0 y)))))) 981 (string-lessp (nth 0 x) (nth 0 y))))))
982 982
@@ -1010,8 +1010,7 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored."
1010 (or (nth 3 attr) "nogroup") ; gid 1010 (or (nth 3 attr) "nogroup") ; gid
1011 (or (nth 7 attr) (nth 2 x)) ; size 1011 (or (nth 7 attr) (nth 2 x)) ; size
1012 (format-time-string 1012 (format-time-string
1013 (if (tramp-time-less-p 1013 (if (time-less-p (time-subtract (current-time) (nth 3 x))
1014 (tramp-time-subtract (current-time) (nth 3 x))
1015 tramp-half-a-year) 1014 tramp-half-a-year)
1016 "%b %e %R" 1015 "%b %e %R"
1017 "%b %e %Y") 1016 "%b %e %Y")
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 5889743e28b..085b527a57f 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -2253,8 +2253,9 @@ Falls back to normal file name handler if no Tramp file name handler exists."
2253;;;###autoload 2253;;;###autoload
2254(progn (defun tramp-autoload-file-name-handler (operation &rest args) 2254(progn (defun tramp-autoload-file-name-handler (operation &rest args)
2255 "Load Tramp file name handler, and perform OPERATION." 2255 "Load Tramp file name handler, and perform OPERATION."
2256 ;; Avoid recursive loading of tramp.el. 2256 ;; Avoid recursive loading of tramp.el. `temporary-file-directory'
2257 (let ((default-directory temporary-file-directory)) 2257 ;; does not exist in XEmacs, so we must use something else.
2258 (let ((default-directory (or (symbol-value 'temporary-file-directory) "/")))
2258 (load "tramp" nil t)) 2259 (load "tramp" nil t))
2259 (apply operation args))) 2260 (apply operation args)))
2260 2261
@@ -2968,8 +2969,8 @@ User is always nil."
2968 (cond 2969 (cond
2969 ((not (file-exists-p file1)) nil) 2970 ((not (file-exists-p file1)) nil)
2970 ((not (file-exists-p file2)) t) 2971 ((not (file-exists-p file2)) t)
2971 (t (tramp-time-less-p (nth 5 (file-attributes file2)) 2972 (t (time-less-p (nth 5 (file-attributes file2))
2972 (nth 5 (file-attributes file1)))))) 2973 (nth 5 (file-attributes file1))))))
2973 2974
2974(defun tramp-handle-file-regular-p (filename) 2975(defun tramp-handle-file-regular-p (filename)
2975 "Like `file-regular-p' for Tramp files." 2976 "Like `file-regular-p' for Tramp files."
@@ -4171,7 +4172,8 @@ Invokes `password-read' if available, `read-passwd' else."
4171 (tramp-check-for-regexp proc tramp-password-prompt-regexp) 4172 (tramp-check-for-regexp proc tramp-password-prompt-regexp)
4172 (format "%s for %s " (capitalize (match-string 1)) key)))) 4173 (format "%s for %s " (capitalize (match-string 1)) key))))
4173 ;; We suspend the timers while reading the password. 4174 ;; We suspend the timers while reading the password.
4174 (stimers (with-timeout-suspend)) 4175 (stimers (and (functionp 'with-timeout-suspend)
4176 (tramp-compat-funcall 'with-timeout-suspend)))
4175 auth-info auth-passwd) 4177 auth-info auth-passwd)
4176 4178
4177 (unwind-protect 4179 (unwind-protect
@@ -4211,7 +4213,8 @@ Invokes `password-read' if available, `read-passwd' else."
4211 (read-passwd pw-prompt)) 4213 (read-passwd pw-prompt))
4212 (tramp-set-connection-property v "first-password-request" nil))) 4214 (tramp-set-connection-property v "first-password-request" nil)))
4213 ;; Reenable the timers. 4215 ;; Reenable the timers.
4214 (with-timeout-unsuspend stimers)))) 4216 (and (functionp 'with-timeout-unsuspend)
4217 (tramp-compat-funcall 'with-timeout-unsuspend stimers)))))
4215 4218
4216;;;###tramp-autoload 4219;;;###tramp-autoload
4217(defun tramp-clear-passwd (vec) 4220(defun tramp-clear-passwd (vec)
@@ -4236,26 +4239,6 @@ Invokes `password-read' if available, `read-passwd' else."
4236 ("oct" . 10) ("nov" . 11) ("dec" . 12)) 4239 ("oct" . 10) ("nov" . 11) ("dec" . 12))
4237 "Alist mapping month names to integers.") 4240 "Alist mapping month names to integers.")
4238 4241
4239;; FIXME: Shouldn't this also look at any subseconds parts of T1 and T2?
4240;;;###tramp-autoload
4241(defun tramp-time-less-p (t1 t2)
4242 "Say whether time value T1 is less than time value T2."
4243 (unless t1 (setq t1 '(0 0)))
4244 (unless t2 (setq t2 '(0 0)))
4245 (or (< (car t1) (car t2))
4246 (and (= (car t1) (car t2))
4247 (< (nth 1 t1) (nth 1 t2)))))
4248
4249;; FIXME: Shouldn't this also look at any subseconds parts of T1 and T2?
4250(defun tramp-time-subtract (t1 t2)
4251 "Subtract two time values.
4252Return the difference in the format of a time value."
4253 (unless t1 (setq t1 '(0 0)))
4254 (unless t2 (setq t2 '(0 0)))
4255 (let ((borrow (< (cadr t1) (cadr t2))))
4256 (list (- (car t1) (car t2) (if borrow 1 0))
4257 (- (+ (if borrow 65536 0) (cadr t1)) (cadr t2)))))
4258
4259;;;###tramp-autoload 4242;;;###tramp-autoload
4260(defun tramp-time-diff (t1 t2) 4243(defun tramp-time-diff (t1 t2)
4261 "Return the difference between the two times, in seconds. 4244 "Return the difference between the two times, in seconds.
@@ -4274,7 +4257,7 @@ T1 and T2 are time values (as returned by `current-time' for example)."
4274 (if (< (length t1) 3) (append t1 '(0)) t1) 4257 (if (< (length t1) 3) (append t1 '(0)) t1)
4275 (if (< (length t2) 3) (append t2 '(0)) t2))) 4258 (if (< (length t2) 3) (append t2 '(0)) t2)))
4276 (t 4259 (t
4277 (let ((time (tramp-time-subtract t1 t2))) 4260 (let ((time (time-subtract t1 t2)))
4278 (+ (* (car time) 65536.0) 4261 (+ (* (car time) 65536.0)
4279 (cadr time) 4262 (cadr time)
4280 (/ (or (nth 2 time) 0) 1000000.0)))))) 4263 (/ (or (nth 2 time) 0) 1000000.0))))))