From e2f785991d0c696fbb2bc2f331f888d979b8da82 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 8 May 2016 12:46:00 -0700 Subject: Simplify now that float-time etc. are built-in This was prompted by warnings about calls to now-obsolete functions. * lisp/calendar/time-date.el (encode-time-value): Use setq rather than a recursive call, to avoid a warning about calling this obsolete function. * lisp/calendar/time-date.el (encode-time-value) (with-decoded-time-value, time-to-seconds, time-to-number-of-days): * lisp/erc/erc.el (erc-emacs-time-to-erc-time): * lisp/net/rcirc.el (rcirc-float-time): * lisp/org/org-compat.el (org-float-time): Simplify now that time-add and float-time are now built-in. * lisp/calendar/time-date.el (time-add, time-subtract, time-less-p): * lisp/net/newst-backend.el (time-add): * lisp/org/org.el (time-subtract): Remove backward-compatibility definitions; they are now built-in. * lisp/calendar/timeclock.el (timeclock-time-to-seconds) (timeclock-seconds-to-time): * lisp/net/rcirc.el (rcirc-float-time): * lisp/org/org-compat.el (org-float-time): Now obsolete, since callers can just use float-time and seconds-to-time. All uses changed. * lisp/emacs-lisp/ert.el (ert-results-pop-to-timings): * lisp/gnus/gnus-art.el (article-lapsed-string): * lisp/gnus/gnus-diary.el (gnus-user-format-function-d): * lisp/gnus/gnus-group.el (gnus-group-timestamp-delta): * lisp/gnus/nndiary.el (nndiary-compute-reminders): * lisp/net/tramp.el (tramp-time-diff): * lisp/org/org-clock.el (org-clock-timestamps-change): Prefer the time-subtract builtin to the subtract-time alias. * lisp/files.el (dir-locals-find-file, dir-locals-read-from-dir): * test/lisp/character-fold-tests.el (character-fold--speed-test): Prefer the float-time builtin to the time-to-seconds alias. * lisp/org/org-agenda.el, lisp/org/org-clock.el, lisp/org/org-list.el: * lisp/org/org-timer.el, lisp/org/org.el: Adjust to org-float-time deprecation. --- lisp/net/newst-backend.el | 7 ------- lisp/net/rcirc.el | 11 ++++------- lisp/net/tramp.el | 2 +- 3 files changed, 5 insertions(+), 15 deletions(-) (limited to 'lisp/net') diff --git a/lisp/net/newst-backend.el b/lisp/net/newst-backend.el index 2596e56aa47..41b21722723 100644 --- a/lisp/net/newst-backend.el +++ b/lisp/net/newst-backend.el @@ -442,13 +442,6 @@ buffers *newsticker-wget-* will not be closed." ;; FIXME It is bad practice to define compat functions with such generic names. -;; This is not needed in Emacs >= 22.1. -(unless (fboundp 'time-add) - (require 'time-date);;FIXME - (defun time-add (t1 t2) - (with-no-warnings ; don't warn about obsolete time-to-seconds in 23.2 - (seconds-to-time (+ (time-to-seconds t1) (time-to-seconds t2)))))) - (unless (fboundp 'match-string-no-properties) (defalias 'match-string-no-properties 'match-string)) diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el index f2c8c5d50c5..66e6326085c 100644 --- a/lisp/net/rcirc.el +++ b/lisp/net/rcirc.el @@ -611,10 +611,7 @@ If ARG is non-nil, instead prompt for connection parameters." `(with-current-buffer rcirc-server-buffer ,@body)) -(defalias 'rcirc-float-time - (if (featurep 'xemacs) - 'time-to-seconds - 'float-time)) +(define-obsolete-function-alias 'rcirc-float-time 'float-time "26.1") (defun rcirc-prompt-for-encryption (server-plist) "Prompt the user for the encryption method to use. @@ -638,7 +635,7 @@ last ping." (rcirc-send-ctcp process rcirc-nick (format "KEEPALIVE %f" - (rcirc-float-time)))))) + (float-time)))))) (rcirc-process-list)) ;; no processes, clean up timer (when (timerp rcirc-keepalive-timer) @@ -647,7 +644,7 @@ last ping." (defun rcirc-handler-ctcp-KEEPALIVE (process _target _sender message) (with-rcirc-process-buffer process - (setq header-line-format (format "%f" (- (rcirc-float-time) + (setq header-line-format (format "%f" (- (float-time) (string-to-number message)))))) (defvar rcirc-debug-buffer "*rcirc debug*") @@ -2342,7 +2339,7 @@ With a prefix arg, prompt for new topic." (defun rcirc-ctcp-sender-PING (process target _request) "Send a CTCP PING message to TARGET." - (let ((timestamp (format "%.0f" (rcirc-float-time)))) + (let ((timestamp (format "%.0f" (float-time)))) (rcirc-send-ctcp process target "PING" timestamp))) (defun rcirc-cmd-me (args &optional process target) diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index aa335d3ce02..377b529803c 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -4124,7 +4124,7 @@ Invokes `password-read' if available, `read-passwd' else." (defun tramp-time-diff (t1 t2) "Return the difference between the two times, in seconds. T1 and T2 are time values (as returned by `current-time' for example)." - (float-time (subtract-time t1 t2))) + (float-time (time-subtract t1 t2))) ;; Currently (as of Emacs 20.5), the function `shell-quote-argument' ;; does not deal well with newline characters. Newline is replaced by -- cgit v1.2.3