aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/org/org.el
diff options
context:
space:
mode:
authorPaul Eggert2016-05-08 12:46:00 -0700
committerPaul Eggert2016-05-08 12:46:22 -0700
commite2f785991d0c696fbb2bc2f331f888d979b8da82 (patch)
treeba345e8547f4542bfe9bbb9ef311405bd519cd97 /lisp/org/org.el
parent2eb6817ba971184cc109f8530f4b3b38f65650ea (diff)
downloademacs-e2f785991d0c696fbb2bc2f331f888d979b8da82.tar.gz
emacs-e2f785991d0c696fbb2bc2f331f888d979b8da82.zip
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.
Diffstat (limited to 'lisp/org/org.el')
-rw-r--r--lisp/org/org.el23
1 files changed, 11 insertions, 12 deletions
diff --git a/lisp/org/org.el b/lisp/org/org.el
index 1921a59bbd0..e2fbf7bc314 100644
--- a/lisp/org/org.el
+++ b/lisp/org/org.el
@@ -5280,7 +5280,6 @@ This variable is set by `org-before-change-function'.
5280 5280
5281;; Other stuff we need. 5281;; Other stuff we need.
5282(require 'time-date) 5282(require 'time-date)
5283(unless (fboundp 'time-subtract) (defalias 'time-subtract 'subtract-time))
5284(require 'easymenu) 5283(require 'easymenu)
5285(require 'overlay) 5284(require 'overlay)
5286 5285
@@ -5514,8 +5513,8 @@ the rounding returns a past time."
5514 (apply 'encode-time 5513 (apply 'encode-time
5515 (append (list 0 (* r (floor (+ .5 (/ (float (nth 1 time)) r))))) 5514 (append (list 0 (* r (floor (+ .5 (/ (float (nth 1 time)) r)))))
5516 (nthcdr 2 time)))) 5515 (nthcdr 2 time))))
5517 (if (and past (< (org-float-time (time-subtract (current-time) res)) 0)) 5516 (if (and past (< (float-time (time-subtract (current-time) res)) 0))
5518 (seconds-to-time (- (org-float-time res) (* r 60))) 5517 (seconds-to-time (- (float-time res) (* r 60)))
5519 res)))) 5518 res))))
5520 5519
5521(defun org-today () 5520(defun org-today ()
@@ -8779,24 +8778,24 @@ links."
8779 (if (or (re-search-forward org-ts-regexp end t) 8778 (if (or (re-search-forward org-ts-regexp end t)
8780 (re-search-forward org-ts-regexp-both end t)) 8779 (re-search-forward org-ts-regexp-both end t))
8781 (org-time-string-to-seconds (match-string 0)) 8780 (org-time-string-to-seconds (match-string 0))
8782 (org-float-time now)))) 8781 (float-time now))))
8783 ((= dcst ?c) 8782 ((= dcst ?c)
8784 (let ((end (save-excursion (outline-next-heading) (point)))) 8783 (let ((end (save-excursion (outline-next-heading) (point))))
8785 (if (re-search-forward 8784 (if (re-search-forward
8786 (concat "^[ \t]*\\[" org-ts-regexp1 "\\]") 8785 (concat "^[ \t]*\\[" org-ts-regexp1 "\\]")
8787 end t) 8786 end t)
8788 (org-time-string-to-seconds (match-string 0)) 8787 (org-time-string-to-seconds (match-string 0))
8789 (org-float-time now)))) 8788 (float-time now))))
8790 ((= dcst ?s) 8789 ((= dcst ?s)
8791 (let ((end (save-excursion (outline-next-heading) (point)))) 8790 (let ((end (save-excursion (outline-next-heading) (point))))
8792 (if (re-search-forward org-scheduled-time-regexp end t) 8791 (if (re-search-forward org-scheduled-time-regexp end t)
8793 (org-time-string-to-seconds (match-string 1)) 8792 (org-time-string-to-seconds (match-string 1))
8794 (org-float-time now)))) 8793 (float-time now))))
8795 ((= dcst ?d) 8794 ((= dcst ?d)
8796 (let ((end (save-excursion (outline-next-heading) (point)))) 8795 (let ((end (save-excursion (outline-next-heading) (point))))
8797 (if (re-search-forward org-deadline-time-regexp end t) 8796 (if (re-search-forward org-deadline-time-regexp end t)
8798 (org-time-string-to-seconds (match-string 1)) 8797 (org-time-string-to-seconds (match-string 1))
8799 (org-float-time now)))) 8798 (float-time now))))
8800 ((= dcst ?p) 8799 ((= dcst ?p)
8801 (if (re-search-forward org-priority-regexp (point-at-eol) t) 8800 (if (re-search-forward org-priority-regexp (point-at-eol) t)
8802 (string-to-char (match-string 2)) 8801 (string-to-char (match-string 2))
@@ -8860,7 +8859,7 @@ If WITH-CASE is non-nil, the sorting will be case-sensitive."
8860 (lambda (x) 8859 (lambda (x)
8861 (if (or (string-match org-ts-regexp x) 8860 (if (or (string-match org-ts-regexp x)
8862 (string-match org-ts-regexp-both x)) 8861 (string-match org-ts-regexp-both x))
8863 (org-float-time 8862 (float-time
8864 (org-time-string-to-time (match-string 0 x))) 8863 (org-time-string-to-time (match-string 0 x)))
8865 0)) 8864 0))
8866 comparefun (if (= dcst sorting-type) '< '>))) 8865 comparefun (if (= dcst sorting-type) '< '>)))
@@ -16886,7 +16885,7 @@ Don't touch the rest."
16886(defun org-time-stamp-to-now (timestamp-string &optional seconds) 16885(defun org-time-stamp-to-now (timestamp-string &optional seconds)
16887 "Difference between TIMESTAMP-STRING and now in days. 16886 "Difference between TIMESTAMP-STRING and now in days.
16888If SECONDS is non-nil, return the difference in seconds." 16887If SECONDS is non-nil, return the difference in seconds."
16889 (let ((fdiff (if seconds 'org-float-time 'time-to-days))) 16888 (let ((fdiff (if seconds 'float-time 'time-to-days)))
16890 (- (funcall fdiff (org-time-string-to-time timestamp-string)) 16889 (- (funcall fdiff (org-time-string-to-time timestamp-string))
16891 (funcall fdiff (current-time))))) 16890 (funcall fdiff (current-time)))))
16892 16891
@@ -17041,8 +17040,8 @@ days in order to avoid rounding problems."
17041 (match-end (match-end 0)) 17040 (match-end (match-end 0))
17042 (time1 (org-time-string-to-time ts1)) 17041 (time1 (org-time-string-to-time ts1))
17043 (time2 (org-time-string-to-time ts2)) 17042 (time2 (org-time-string-to-time ts2))
17044 (t1 (org-float-time time1)) 17043 (t1 (float-time time1))
17045 (t2 (org-float-time time2)) 17044 (t2 (float-time time2))
17046 (diff (abs (- t2 t1))) 17045 (diff (abs (- t2 t1)))
17047 (negative (< (- t2 t1) 0)) 17046 (negative (< (- t2 t1) 0))
17048 ;; (ys (floor (* 365 24 60 60))) 17047 ;; (ys (floor (* 365 24 60 60)))
@@ -17107,7 +17106,7 @@ days in order to avoid rounding problems."
17107 17106
17108(defun org-time-string-to-seconds (s) 17107(defun org-time-string-to-seconds (s)
17109 "Convert a timestamp string to a number of seconds." 17108 "Convert a timestamp string to a number of seconds."
17110 (org-float-time (org-time-string-to-time s))) 17109 (float-time (org-time-string-to-time s)))
17111 17110
17112(defun org-time-string-to-absolute (s &optional daynr prefer show-all buffer pos) 17111(defun org-time-string-to-absolute (s &optional daynr prefer show-all buffer pos)
17113 "Convert a time stamp to an absolute day number. 17112 "Convert a time stamp to an absolute day number.