From: Michael Albinus Date: Sat, 23 Feb 2019 10:56:37 +0000 (+0100) Subject: Make last Tramp change backward compatible to Emacs 24 X-Git-Tag: emacs-27.0.90~3555 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=5f640bfdf84753322763be23ebaa8ded92dc1c5d;p=emacs.git Make last Tramp change backward compatible to Emacs 24 * 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. --- diff --git a/lisp/net/tramp-cache.el b/lisp/net/tramp-cache.el index 064b209ec2f..0fb9bea14bc 100644 --- a/lisp/net/tramp-cache.el +++ b/lisp/net/tramp-cache.el @@ -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))))) diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 91ff1532933..2d02961db5e 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -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) diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el index 31470b29790..eda30812ebc 100644 --- a/lisp/net/tramp-smb.el +++ b/lisp/net/tramp-smb.el @@ -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)