diff options
author | Kyle Meyer <kyle@kyleam.com> | 2015-07-26 23:28:09 -0400 |
---|---|---|
committer | Kyle Meyer <kyle@kyleam.com> | 2015-07-26 23:28:09 -0400 |
commit | 5a01b116a40fd87583cfb08d821b73cbe99f5a2d (patch) | |
tree | 41bd1269b90e390820a045124db45d23a672d451 | |
parent | 217ad4aafbf7daeb1045efac4a5c80a8f97d553a (diff) | |
download | org-mode-5a01b116a40fd87583cfb08d821b73cbe99f5a2d.tar.gz |
Pass current-time as optional arg for tests
* lisp/org.el (org-read-date-analyze):
* lisp/org-timer.el (org-timer-seconds): Explicitly pass current-time as
optional time argument and explain reason in comment.
This reverts some changes from 91ab6c4 ("Backport commit 123ddec from
Emacs master branch", 2014-10-28).
-rw-r--r-- | lisp/org-timer.el | 7 | ||||
-rw-r--r-- | lisp/org.el | 10 |
2 files changed, 13 insertions, 4 deletions
diff --git a/lisp/org-timer.el b/lisp/org-timer.el index b22db7b..3d1e5a5 100644 --- a/lisp/org-timer.el +++ b/lisp/org-timer.el @@ -193,10 +193,13 @@ it in the buffer." (defvar org-timer-timer-is-countdown nil) (defun org-timer-seconds () + ;; Pass `current-time' result to `org-float-time' + ;; (instead of calling without arguments) so that only + ;; `current-time' has to be overriden in tests. (if org-timer-timer-is-countdown (- (org-float-time org-timer-start-time) - (org-float-time)) - (- (org-float-time org-timer-pause-time) + (org-float-time (current-time))) + (- (org-float-time (or org-timer-pause-time (current-time))) (org-float-time org-timer-start-time)))) ;;;###autoload diff --git a/lisp/org.el b/lisp/org.el index 4749e94..c852a80 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -16494,7 +16494,10 @@ user." (defun org-read-date-analyze (ans org-def org-defdecode) "Analyze the combined answer of the date prompt." ;; FIXME: cleanup and comment - (let ((nowdecode (decode-time)) + ;; Pass `current-time' result to `decode-time' (instead of calling + ;; without arguments) so that only `current-time' has to be + ;; overriden in tests. + (let ((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-year iso-date futurep kill-year) @@ -16652,7 +16655,10 @@ user." (deltan (setq futurep nil) (unless deltadef - (let ((now (decode-time))) + ;; Pass `current-time' result to `decode-time' (instead of + ;; calling without arguments) so that only `current-time' has + ;; to be overriden in tests. + (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)))) |