summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2019-02-12 19:46:03 -0500
committerKyle Meyer <kyle@kyleam.com>2019-02-12 19:46:03 -0500
commit6a5be09c1d79771c696315adf9f50bec9c8ba1f8 (patch)
treead51f4c524a68b05acdab7c1842db3174ac8903b
parent2cd1f9b028b0d86fa433b72a91cfbec24bc599a2 (diff)
downloadorg-mode-6a5be09c1d79771c696315adf9f50bec9c8ba1f8.tar.gz
Restore some current-time to nil changes
* lisp/org-colview.el (org-columns-compute-all): * lisp/org-timer.el (org-timer-start): (org-timer-pause-or-continue): (org-timer-seconds): * lisp/org.el (org-read-date-analyze): Favor nil argument to explicitly passing current-time result to float-time and decode-time. Most of these "(current-time) => nil" changes were made in the Emacs codebase, but we stayed with the original state because we relied on explicitly overriding current-time in the tests. As of the last commit, we no longer need to do this and can use org-test-at-time instead.
-rw-r--r--lisp/org-colview.el5
-rw-r--r--lisp/org-timer.el18
-rw-r--r--lisp/org.el10
3 files changed, 9 insertions, 24 deletions
diff --git a/lisp/org-colview.el b/lisp/org-colview.el
index 5676f38..746426b 100644
--- a/lisp/org-colview.el
+++ b/lisp/org-colview.el
@@ -1224,10 +1224,7 @@ column specification."
"Compute all columns that have operators defined."
(with-silent-modifications
(remove-text-properties (point-min) (point-max) '(org-summaries t)))
- ;; 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)))
+ (let ((org-columns--time (float-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 dae2bab..73583b3 100644
--- a/lisp/org-timer.el
+++ b/lisp/org-timer.el
@@ -141,10 +141,7 @@ the region 0:00:00."
(setq delta (org-timer-hms-to-secs (org-timer-fix-incomplete s)))))
(setq org-timer-start-time
(seconds-to-time
- ;; 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 (current-time)) delta))))
+ (- (float-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"
@@ -174,7 +171,7 @@ With prefix arg STOP, stop it entirely."
(setq org-timer-start-time
(time-add (current-time) (seconds-to-time new-secs))))
(setq org-timer-start-time
- (seconds-to-time (- (float-time (current-time))
+ (seconds-to-time (- (float-time)
(- pause-secs start-secs)))))
(setq org-timer-pause-time nil)
(org-timer-set-mode-line 'on)
@@ -235,13 +232,10 @@ it in the buffer."
(abs (floor (org-timer-seconds))))))
(defun org-timer-seconds ()
- ;; Pass `current-time' result to `float-time' (instead of calling
- ;; without arguments) so that only `current-time' has to be
- ;; overridden in tests.
(if org-timer-countdown-timer
(- (float-time org-timer-start-time)
- (float-time (or org-timer-pause-time (current-time))))
- (- (float-time (or org-timer-pause-time (current-time)))
+ (float-time org-timer-pause-time))
+ (- (float-time org-timer-pause-time)
(float-time org-timer-start-time))))
;;;###autoload
@@ -465,8 +459,8 @@ 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.
+ ;; Pass `current-time' result to `time-add' (instead of nil)
+ ;; for for Emacs 24 compatibility.
(setq org-timer-start-time
(time-add (current-time) (seconds-to-time secs)))
(setq org-timer-pause-time nil)
diff --git a/lisp/org.el b/lisp/org.el
index e968803..09feee1 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -16409,12 +16409,9 @@ user."
(defun org-read-date-analyze (ans def defdecode)
"Analyze the combined answer of the date prompt."
;; FIXME: cleanup and comment
- ;; Pass `current-time' result to `decode-time' (instead of calling
- ;; without arguments) so that only `current-time' has to be
- ;; overridden in tests.
(let ((org-def def)
(org-defdecode defdecode)
- (nowdecode (decode-time (current-time)))
+ (nowdecode (decode-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)
@@ -16591,10 +16588,7 @@ user."
(deltan
(setq futurep nil)
(unless deltadef
- ;; 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 (current-time))))
+ (let ((now (decode-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))))