]> git.eshelyaron.com Git - emacs.git/commitdiff
Make last Tramp change backward compatible to Emacs 24
authorMichael Albinus <michael.albinus@gmx.de>
Sat, 23 Feb 2019 10:56:37 +0000 (11:56 +0100)
committerMichael Albinus <michael.albinus@gmx.de>
Sat, 23 Feb 2019 10:56:37 +0000 (11:56 +0100)
* lisp/net/tramp-cache.el (tramp-get-file-property):
* lisp/net/tramp-sh.el (tramp-maybe-open-connection):
* lisp/net/tramp-smb.el (tramp-smb-maybe-open-connection):
Make them backward compatible to Emacs 24.

lisp/net/tramp-cache.el
lisp/net/tramp-sh.el
lisp/net/tramp-smb.el

index 064b209ec2f911a653ecbd6b5676fd82b0a0c6ed..0fb9bea14bca6a20e679b4e8a948c1dd22d65712 100644 (file)
@@ -128,9 +128,14 @@ Returns DEFAULT if not set."
        (and (consp value)
             (or (null remote-file-name-inhibit-cache)
                 (and (integerp remote-file-name-inhibit-cache)
-                     (time-less-p nil
-                                  (time-add (car value)
-                                            remote-file-name-inhibit-cache)))
+                     (time-less-p
+                      ;; `current-time' can be nil once we get rid of Emacs 24.
+                      (current-time)
+                      (time-add
+                       (car value)
+                      ;; `seconds-to-time' can be removed once we get
+                      ;; rid of Emacs 24.
+                       (seconds-to-time remote-file-name-inhibit-cache))))
                 (and (consp remote-file-name-inhibit-cache)
                      (time-less-p
                       remote-file-name-inhibit-cache (car value)))))
index 91ff15329338ef0cfc8ecc4c659524923ecfd539..2d02961db5eddc0ff3bc2f98cf67dfc6936acb63 100644 (file)
@@ -4785,8 +4785,11 @@ connection if a previous connection has died for some reason."
                (not (tramp-file-name-equal-p
                      vec (car tramp-current-connection)))
                (time-less-p
-                (or tramp-connection-min-time-diff 0)
-                (time-since (cdr tramp-current-connection))))
+                ;; `current-time' can be removed once we get rid of Emacs 24.
+                (time-since (or (cdr tramp-current-connection) (current-time)))
+                ;; `seconds-to-time' can be removed once we get rid
+                ;; of Emacs 24.
+                (seconds-to-time (or tramp-connection-min-time-diff 0))))
       (throw 'suppress 'suppress))
 
     ;; If too much time has passed since last command was sent, look
@@ -4797,10 +4800,11 @@ connection if a previous connection has died for some reason."
     ;; try to send a command from time to time, then look again
     ;; whether the process is really alive.
     (condition-case nil
-       (when (and (time-less-p 60
+       ;; `seconds-to-time' can be removed once we get rid of Emacs 24.
+       (when (and (time-less-p (seconds-to-time 60)
                                (time-since
                                 (tramp-get-connection-property
-                                 p "last-cmd-time" 0)))
+                                 p "last-cmd-time" (seconds-to-time 0))))
                   (process-live-p p))
          (tramp-send-command vec "echo are you awake" t t)
          (unless (and (process-live-p p)
index 31470b29790db93ddc27bf4e7ee73b7a3278ea07..eda30812ebc74b1d6c06c57dd4ceb32f37e8290a 100644 (file)
@@ -1900,10 +1900,11 @@ If ARGUMENT is non-nil, use it as argument for
     ;; connection timeout.
     (with-current-buffer buf
       (goto-char (point-min))
-      (when (and (time-less-p 60
+      ;; `seconds-to-time' can be removed once we get rid of Emacs 24.
+      (when (and (time-less-p (seconds-to-time 60)
                              (time-since
                               (tramp-get-connection-property
-                               p "last-cmd-time" 0)))
+                               p "last-cmd-time" (seconds-to-time 0))))
                 (process-live-p p)
                 (re-search-forward tramp-smb-errors nil t))
        (delete-process p)