diff options
author | Kyle Meyer <kyle@kyleam.com> | 2018-08-26 13:32:51 -0400 |
---|---|---|
committer | Kyle Meyer <kyle@kyleam.com> | 2019-01-13 12:43:04 -0500 |
commit | 6df3e8880e8ba33ebaf09d12c271b1dfafe71ce3 (patch) | |
tree | 8ac06bcfa41126016d2671fe02dce14c901d5c86 | |
parent | eb10ad93600edc595b7bbe1498f6ebc9ccf5d799 (diff) | |
download | org-mode-6df3e8880e8ba33ebaf09d12c271b1dfafe71ce3.tar.gz |
Partially revert backport of c75f505de
* lisp/org-colview.el (org-columns-compute-all):
* lisp/org-timer.el (org-timer-start):
(org-timer-pause-or-continue):
(org-timer-seconds):
(org-timer-set-timer):
* lisp/org.el (org-read-date-analyze): Restore use of `current-time`
for testing purposes.
In these spots, we call (current-time) so that it can be overriden in
tests. Add a comment about this in the cases that don't have one.
-rw-r--r-- | lisp/org-colview.el | 5 | ||||
-rw-r--r-- | lisp/org-timer.el | 20 | ||||
-rw-r--r-- | lisp/org.el | 4 |
3 files changed, 17 insertions, 12 deletions
diff --git a/lisp/org-colview.el b/lisp/org-colview.el index 746426b..5676f38 100644 --- a/lisp/org-colview.el +++ b/lisp/org-colview.el @@ -1224,7 +1224,10 @@ column specification." "Compute all columns that have operators defined." (with-silent-modifications (remove-text-properties (point-min) (point-max) '(org-summaries t))) - (let ((org-columns--time (float-time)) + ;; Pass `current-time' result to `float-time' (instead of calling + ;; without arguments) so that only `current-time' has to be + ;; overridden in tests. + (let ((org-columns--time (float-time (current-time))) seen) (dolist (spec org-columns-current-fmt-compiled) (let ((property (car spec))) diff --git a/lisp/org-timer.el b/lisp/org-timer.el index 1ef400e..d0e6257 100644 --- a/lisp/org-timer.el +++ b/lisp/org-timer.el @@ -144,7 +144,7 @@ the region 0:00:00." ;; Pass `current-time' result to `float-time' (instead ;; of calling without arguments) so that only ;; `current-time' has to be overridden in tests. - (- (float-time) delta)))) + (- (float-time (current-time)) delta)))) (setq org-timer-pause-time nil) (org-timer-set-mode-line 'on) (message "Timer start time set to %s, current value is %s" @@ -163,18 +163,18 @@ With prefix arg STOP, stop it entirely." (org-timer-pause-time (let ((start-secs (float-time org-timer-start-time)) (pause-secs (float-time org-timer-pause-time))) + ;; Note: We pass the result of `current-time' to `time-add' and + ;; `float-time' below so that we can easily override the value + ;; in tests. (if org-timer-countdown-timer (let ((new-secs (- start-secs pause-secs))) (setq org-timer-countdown-timer (org-timer--run-countdown-timer new-secs org-timer-countdown-timer-title)) (setq org-timer-start-time - (time-add nil (seconds-to-time new-secs)))) + (time-add (current-time) (seconds-to-time new-secs)))) (setq org-timer-start-time - ;; Pass `current-time' result to `float-time' (instead - ;; of calling without arguments) so that only - ;; `current-time' has to be overridden in tests. - (seconds-to-time (- (float-time) + (seconds-to-time (- (float-time (current-time)) (- pause-secs start-secs))))) (setq org-timer-pause-time nil) (org-timer-set-mode-line 'on) @@ -240,8 +240,8 @@ it in the buffer." ;; overridden in tests. (if org-timer-countdown-timer (- (float-time org-timer-start-time) - (float-time org-timer-pause-time)) - (- (float-time org-timer-pause-time) + (float-time (or org-timer-pause-time (current-time)))) + (- (float-time (or org-timer-pause-time (current-time))) (float-time org-timer-start-time)))) ;;;###autoload @@ -465,8 +465,10 @@ using three `C-u' prefix arguments." (org-timer--run-countdown-timer secs org-timer-countdown-timer-title)) (run-hooks 'org-timer-set-hook) + ;; Pass `current-time' result to `add-time' (instead nil) so + ;; that only `current-time' has to be overridden in tests. (setq org-timer-start-time - (time-add nil (seconds-to-time secs))) + (time-add (current-time) (seconds-to-time secs))) (setq org-timer-pause-time nil) (org-timer-set-mode-line 'on)))))) diff --git a/lisp/org.el b/lisp/org.el index 1c58048..dee25de 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -16399,7 +16399,7 @@ user." ;; overridden in tests. (let ((org-def def) (org-defdecode defdecode) - (nowdecode (decode-time)) + (nowdecode (decode-time (current-time))) delta deltan deltaw deltadef year month day hour minute second wday pm h2 m2 tl wday1 iso-year iso-weekday iso-week iso-date futurep kill-year) @@ -16579,7 +16579,7 @@ user." ;; Pass `current-time' result to `decode-time' (instead of ;; calling without arguments) so that only `current-time' has ;; to be overridden in tests. - (let ((now (decode-time))) + (let ((now (decode-time (current-time)))) (setq day (nth 3 now) month (nth 4 now) year (nth 5 now)))) (cond ((member deltaw '("d" "")) (setq day (+ day deltan))) ((equal deltaw "w") (setq day (+ day (* 7 deltan)))) |