From ce0da8a427467a2a5e5636f4d69eb56b56b0925e Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Sat, 29 Sep 2018 15:33:48 +0200 Subject: Rework time-* functions in Tramp * doc/misc/emacs-mime.texi (time-date): Add time-equal-p. * lisp/net/tramp-compat.el (tramp-compat-time-equal-p): New defsubst. * lisp/net/tramp.el (tramp-file-name-handler): Remove `debug' error handler. (tramp-half-a-year): Remove. (tramp-time-dont-know, tramp-time-doesnt-exist): New defconst. (tramp-time-diff): Remove compat code. (tramp-handle-set-visited-file-modtime) (tramp-handle-verify-visited-file-modtime): * lisp/net/tramp-adb.el (tramp-do-parse-file-attributes-with-ls) (tramp-adb-handle-set-file-times): * lisp/net/tramp-sh.el (tramp-do-file-attributes-with-ls) (tramp-sh-handle-set-visited-file-modtime) (tramp-sh-handle-verify-visited-file-modtime) (tramp-sh-handle-set-file-times) (tramp-sh-handle-file-newer-than-file-p): Use `tramp-time-dont-know', `tramp-time-doesnt-exist' and `tramp-compat-time-equal-p'. (tramp-sh-handle-verify-visited-file-modtime): Simplify check. * lisp/net/tramp-smb.el (tramp-smb-handle-file-attributes) (tramp-smb-read-file-entry): Use `tramp-time-dont-know'. (tramp-smb-handle-insert-directory): Adapt half-a-year check. * src/editfns.c (Ftime_equal_p): Adapt docstring. * test/lisp/net/tramp-tests.el (tramp-test19-directory-files-and-attributes) (tramp-test22-file-times): Use `tramp-compat-time-equal-p' and `tramp-time-dont-know'. (tramp-test23-visited-file-modtime): Extend test. --- lisp/net/tramp-compat.el | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'lisp/net/tramp-compat.el') diff --git a/lisp/net/tramp-compat.el b/lisp/net/tramp-compat.el index bcfaf40ebc1..c3777e6e737 100644 --- a/lisp/net/tramp-compat.el +++ b/lisp/net/tramp-compat.el @@ -247,6 +247,14 @@ If NAME is a remote file name, the local part of NAME is unquoted." (funcall handler 'exec-path) exec-path))))) +;; `time-equal-p' has appeared in Emacs 27.1. +(if (fboundp 'time-equal-p) + (defalias 'tramp-compat-time-equal-p 'time-equal-p) + (defsubst tramp-compat-time-equal-p (t1 t2) + "Return non-nil if time value T1 is equal to time value T2. +A nil value for either argument stands for the current time." + (equal (or t1 (current-time)) (or t2 (current-time))))) + (add-hook 'tramp-unload-hook (lambda () (unload-feature 'tramp-loaddefs 'force) -- cgit v1.2.3