]> git.eshelyaron.com Git - emacs.git/commitdiff
Improve XEmacs compatibility.
authorMichael Albinus <michael.albinus@gmx.de>
Thu, 20 Nov 2014 19:10:15 +0000 (20:10 +0100)
committerMichael Albinus <michael.albinus@gmx.de>
Thu, 20 Nov 2014 19:10:15 +0000 (20:10 +0100)
* 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.

lisp/ChangeLog
lisp/net/tramp-adb.el
lisp/net/tramp-cache.el
lisp/net/tramp-compat.el
lisp/net/tramp-sh.el
lisp/net/tramp-smb.el
lisp/net/tramp.el

index 306882eaca9697fbd29bcee19d096d212a863e23..164d8c15492b3c7b5c14dd70fe0e42213fb9bfaa 100644 (file)
@@ -1,3 +1,26 @@
+2014-11-20  Michael Albinus  <michael.albinus@gmx.de>
+
+        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.
+
+       * net/ttramp-adb.el (top): Do not require time-date.el.
+
+       * net/ttramp-compat.el (top): Require time-date.el for XEmacs.
+
+       * net/ttramp-sh.el (tramp-open-connection-setup-interactive-shell):
+       Check, whether `utf-8' is a valid coding system.
+
 2014-11-19  Eli Zaretskii  <eliz@gnu.org>
 
        * vc/vc.el (vc-retrieve-tag): Doc fix.
index 2401b4af479f82a043a3cce50baa464dd9409573..1695631d1ae883bc60f29ff8f938d1dde6b3ac35 100644 (file)
@@ -34,7 +34,6 @@
 ;;; Code:
 
 (require 'tramp)
-(require 'time-date)
 
 ;; Pacify byte-compiler.
 (defvar directory-sep-char)
@@ -468,7 +467,7 @@ Emacs dired can't find files."
     (setq time-a (apply 'encode-time (parse-time-string (match-string 0 a))))
     (string-match tramp-adb-ls-date-regexp b)
     (setq time-b (apply 'encode-time (parse-time-string (match-string 0 b))))
-    (tramp-time-less-p time-b time-a)))
+    (time-less-p time-b time-a)))
 
 (defun tramp-adb-ls-output-name-less-p (a b)
   "Sort \"ls\" output by name, ascending."
index a6b7500433b856cff25f4575cfeddb29a01d2312..50c8e249fe3f81296e429e0aff63f86672ba290f 100644 (file)
@@ -136,7 +136,7 @@ Returns DEFAULT if not set."
                       (tramp-time-diff (current-time) (car value))
                       remote-file-name-inhibit-cache))
                 (and (consp remote-file-name-inhibit-cache)
-                     (tramp-time-less-p
+                     (time-less-p
                       remote-file-name-inhibit-cache (car value)))))
        (setq value (cdr value))
       (setq value default))
index cd336ec61b317f185d47045d17a8995d8dc17ace..de63d8c7c7ac1f538143361c8212a1784960a7af 100644 (file)
@@ -44,7 +44,8 @@
     (require 'outline)
     (require 'passwd)
     (require 'pp)
-    (require 'regexp-opt))
+    (require 'regexp-opt)
+    (require 'time-date))
 
   (require 'advice)
   (require 'custom)
index 6e46df254b26e8a49372ad11d517a703653b6041..21ec741d3983e9224866e0bc79a3ffe52ef76618 100644 (file)
@@ -3971,9 +3971,10 @@ process to set up.  VEC specifies the connection."
     (if (featurep 'mule)
        ;; Use MULE to select the right EOL convention for communicating
        ;; with the process.
-       (let ((cs (or (when (string-match
-                            "utf8" (or (tramp-get-remote-locale vec) ""))
-                       (cons 'utf-8 'utf-8))
+       (let ((cs (or (and (memq 'utf-8 (coding-system-list))
+                          (string-match
+                           "utf8" (or (tramp-get-remote-locale vec) ""))
+                          (cons 'utf-8 'utf-8))
                      (tramp-compat-funcall 'process-coding-system proc)
                      (cons 'undecided 'undecided)))
              cs-decode cs-encode)
index 15ae9ed6fa806d73abf90e1c596639c7a40c20ed..3d48f47e58e8c93b4593f20fc25a442e520a4ff5 100644 (file)
@@ -976,7 +976,7 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored."
                 (lambda (x y)
                   (if (string-match "t" switches)
                       ;; Sort by date.
-                      (tramp-time-less-p (nth 3 y) (nth 3 x))
+                      (time-less-p (nth 3 y) (nth 3 x))
                     ;; Sort by name.
                     (string-lessp (nth 0 x) (nth 0 y))))))
 
@@ -1010,8 +1010,7 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored."
                     (or (nth 3 attr) "nogroup") ; gid
                     (or (nth 7 attr) (nth 2 x)) ; size
                     (format-time-string
-                     (if (tramp-time-less-p
-                          (tramp-time-subtract (current-time) (nth 3 x))
+                     (if (time-less-p (time-subtract (current-time) (nth 3 x))
                           tramp-half-a-year)
                          "%b %e %R"
                        "%b %e  %Y")
index 5889743e28bbd2141723ad45fb4878b36ed52bf9..085b527a57fbada989556d47126ba1420a9b370c 100644 (file)
@@ -2253,8 +2253,9 @@ Falls back to normal file name handler if no Tramp file name handler exists."
 ;;;###autoload
 (progn (defun tramp-autoload-file-name-handler (operation &rest args)
   "Load Tramp file name handler, and perform OPERATION."
-  ;; Avoid recursive loading of tramp.el.
-  (let ((default-directory temporary-file-directory))
+  ;; Avoid recursive loading of tramp.el.  `temporary-file-directory'
+  ;; does not exist in XEmacs, so we must use something else.
+  (let ((default-directory (or (symbol-value 'temporary-file-directory) "/")))
     (load "tramp" nil t))
   (apply operation args)))
 
@@ -2968,8 +2969,8 @@ User is always nil."
   (cond
    ((not (file-exists-p file1)) nil)
    ((not (file-exists-p file2)) t)
-   (t (tramp-time-less-p (nth 5 (file-attributes file2))
-                        (nth 5 (file-attributes file1))))))
+   (t (time-less-p (nth 5 (file-attributes file2))
+                  (nth 5 (file-attributes file1))))))
 
 (defun tramp-handle-file-regular-p (filename)
   "Like `file-regular-p' for Tramp files."
@@ -4171,7 +4172,8 @@ Invokes `password-read' if available, `read-passwd' else."
                (tramp-check-for-regexp proc tramp-password-prompt-regexp)
                (format "%s for %s " (capitalize (match-string 1)) key))))
         ;; We suspend the timers while reading the password.
-         (stimers (with-timeout-suspend))
+         (stimers (and (functionp 'with-timeout-suspend)
+                      (tramp-compat-funcall 'with-timeout-suspend)))
         auth-info auth-passwd)
 
     (unwind-protect
@@ -4211,7 +4213,8 @@ Invokes `password-read' if available, `read-passwd' else."
               (read-passwd pw-prompt))
            (tramp-set-connection-property v "first-password-request" nil)))
       ;; Reenable the timers.
-      (with-timeout-unsuspend stimers))))
+      (and (functionp 'with-timeout-unsuspend)
+          (tramp-compat-funcall 'with-timeout-unsuspend stimers)))))
 
 ;;;###tramp-autoload
 (defun tramp-clear-passwd (vec)
@@ -4236,26 +4239,6 @@ Invokes `password-read' if available, `read-passwd' else."
     ("oct" . 10) ("nov" . 11) ("dec" . 12))
   "Alist mapping month names to integers.")
 
-;; FIXME: Shouldn't this also look at any subseconds parts of T1 and T2?
-;;;###tramp-autoload
-(defun tramp-time-less-p (t1 t2)
-  "Say whether time value T1 is less than time value T2."
-  (unless t1 (setq t1 '(0 0)))
-  (unless t2 (setq t2 '(0 0)))
-  (or (< (car t1) (car t2))
-      (and (= (car t1) (car t2))
-          (< (nth 1 t1) (nth 1 t2)))))
-
-;; FIXME: Shouldn't this also look at any subseconds parts of T1 and T2?
-(defun tramp-time-subtract (t1 t2)
-  "Subtract two time values.
-Return the difference in the format of a time value."
-  (unless t1 (setq t1 '(0 0)))
-  (unless t2 (setq t2 '(0 0)))
-  (let ((borrow (< (cadr t1) (cadr t2))))
-    (list (- (car t1) (car t2) (if borrow 1 0))
-         (- (+ (if borrow 65536 0) (cadr t1)) (cadr t2)))))
-
 ;;;###tramp-autoload
 (defun tramp-time-diff (t1 t2)
   "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)."
          (if (< (length t1) 3) (append t1 '(0)) t1)
          (if (< (length t2) 3) (append t2 '(0)) t2)))
         (t
-        (let ((time (tramp-time-subtract t1 t2)))
+        (let ((time (time-subtract t1 t2)))
           (+ (* (car time) 65536.0)
              (cadr time)
              (/ (or (nth 2 time) 0) 1000000.0))))))