summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2019-01-31 22:54:38 -0500
committerKyle Meyer <kyle@kyleam.com>2019-01-31 23:03:10 -0500
commitaf7795533ae8530324284b7d557f3a7a709538e4 (patch)
treeccc1bdb8e2bb66a5d5e1cfbeafec246abedb35cc
parentbf9bf7a17469acf442e61f2b6317dbce2067dc0d (diff)
downloadorg-mode-af7795533ae8530324284b7d557f3a7a709538e4.tar.gz
Revert "(current-time) => nil" for Emacs 24 compatibility
* lisp/org-clock.el (org-clock-resolve-clock): (org-clock-resolve): (org-resolve-clocks-if-idle): * lisp/org-element.el (org-element--cache-interrupt-p): (org-element--cache-sync): * lisp/org-habit.el (org-habit-insert-consistency-graphs): * lisp/org-indent.el (org-indent-add-properties): * lisp/org-timer.el (org-timer-show-remaining-time): * lisp/org.el (org-babel-load-file): (org-current-time): (org-today): (org-auto-repeat-maybe): Revert nil to (current-time) replacement for compatibility with Emacs 24. This reverts many changes introduced by eb10ad936 (Backport commit c75f505de from Emacs, 2017-10-20). Reported-by: Samuel Wales <samologist@gmail.com> <https://lists.gnu.org/archive/html/emacs-orgmode/2019-01/msg00427.html>
-rw-r--r--lisp/org-clock.el17
-rw-r--r--lisp/org-element.el7
-rw-r--r--lisp/org-habit.el2
-rw-r--r--lisp/org-indent.el4
-rw-r--r--lisp/org-timer.el2
-rw-r--r--lisp/org.el9
6 files changed, 26 insertions, 15 deletions
diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index c21451b..fe95437 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -943,7 +943,9 @@ CLOCK is a cons cell of the form (MARKER START-TIME)."
(org-clock-clock-out clock fail-quietly))
((org-is-active-clock clock) nil)
(t (org-clock-clock-in clock t))))
- ((pred (time-less-p nil))
+ ((pred (time-less-p (current-time)))
+ ;; ^ NOTE: Here and in other `time-less-p' calls, we use
+ ;; (current-time) rather than nil for Emacs 24 compatibility.
(error "RESOLVE-TO must refer to a time in the past"))
(_
(when restart (error "RESTART is not valid here"))
@@ -1043,7 +1045,10 @@ to be CLOCKED OUT."))))
(and (not (memq char-pressed '(?i ?q))) char-pressed)))))
(default
(floor (/ (float-time
- (time-subtract nil last-valid)) 60)))
+ ;; NOTE: Here and in other `time-subtract'
+ ;; calls, we use (current-time) rather than nil
+ ;; for Emacs 24 compatibility.
+ (time-subtract (current-time) last-valid)) 60)))
(keep
(and (memq ch '(?k ?K))
(read-number "Keep how many minutes? " default)))
@@ -1080,7 +1085,8 @@ to be CLOCKED OUT."))))
(keep
(time-add last-valid (seconds-to-time (* 60 keep))))
(gotback
- (time-subtract nil (seconds-to-time (* 60 gotback))))
+ (time-subtract (current-time)
+ (seconds-to-time (* 60 gotback))))
(t
(error "Unexpected, please report this as a bug")))
(and gotback last-valid)
@@ -1162,7 +1168,7 @@ so long."
org-clock-marker (marker-buffer org-clock-marker))
(let* ((org-clock-user-idle-seconds (org-user-idle-seconds))
(org-clock-user-idle-start
- (time-subtract nil
+ (time-subtract (current-time)
(seconds-to-time org-clock-user-idle-seconds)))
(org-clock-resolving-clocks-due-to-idleness t))
(if (> org-clock-user-idle-seconds (* 60 org-clock-idle-time))
@@ -1172,7 +1178,8 @@ so long."
(lambda (_)
(format "Clocked in & idle for %.1f mins"
(/ (float-time
- (time-subtract nil org-clock-user-idle-start))
+ (time-subtract (current-time)
+ org-clock-user-idle-start))
60.0)))
org-clock-user-idle-start)))))
diff --git a/lisp/org-element.el b/lisp/org-element.el
index e2d69a4..5cb0935 100644
--- a/lisp/org-element.el
+++ b/lisp/org-element.el
@@ -5117,7 +5117,7 @@ Assume ELEMENT belongs to cache and that a cache is active."
TIME-LIMIT is a time value or nil."
(and time-limit
(or (input-pending-p)
- (time-less-p time-limit nil))))
+ (time-less-p time-limit (current-time)))))
(defsubst org-element--cache-shift-positions (element offset &optional props)
"Shift ELEMENT properties relative to buffer positions by OFFSET.
@@ -5171,7 +5171,10 @@ updated before current modification are actually submitted."
(and next (aref next 0))
threshold
(and (not threshold)
- (time-add nil
+ ;; NOTE: Here and in other `time-add' calls, we use
+ ;; (current-time) rather than nil for Emacs 24
+ ;; compatibility.
+ (time-add (current-time)
org-element-cache-sync-duration))
future-change)
;; Request processed. Merge current and next offsets and
diff --git a/lisp/org-habit.el b/lisp/org-habit.el
index d19075d..af45207 100644
--- a/lisp/org-habit.el
+++ b/lisp/org-habit.el
@@ -406,7 +406,7 @@ current time."
"Insert consistency graph for any habitual tasks."
(let ((inhibit-read-only t)
(buffer-invisibility-spec '(org-link))
- (moment (time-subtract nil
+ (moment (time-subtract (current-time)
(list 0 (* 3600 org-extend-today-until) 0))))
(save-excursion
(goto-char (if line (point-at-bol) (point-min)))
diff --git a/lisp/org-indent.el b/lisp/org-indent.el
index 650a62f..2ac431c 100644
--- a/lisp/org-indent.el
+++ b/lisp/org-indent.el
@@ -333,7 +333,7 @@ stopped."
(let* ((case-fold-search t)
(limited-re (org-get-limited-outline-regexp))
(level (or (org-current-level) 0))
- (time-limit (and delay (time-add nil delay))))
+ (time-limit (and delay (time-add (current-time) delay))))
;; For each line, set `line-prefix' and `wrap-prefix'
;; properties depending on the type of line (headline, inline
;; task, item or other).
@@ -346,7 +346,7 @@ stopped."
;; In asynchronous mode, take a break of
;; `org-indent-agent-resume-delay' every DELAY to avoid
;; blocking any other idle timer or process output.
- ((and delay (time-less-p time-limit nil))
+ ((and delay (time-less-p time-limit (current-time)))
(setq org-indent-agent-resume-timer
(run-with-idle-timer
(time-add (current-idle-time) org-indent-agent-resume-delay)
diff --git a/lisp/org-timer.el b/lisp/org-timer.el
index d0e6257..dae2bab 100644
--- a/lisp/org-timer.el
+++ b/lisp/org-timer.el
@@ -402,7 +402,7 @@ VALUE can be `on', `off', or `paused'."
(message "No timer set")
(let* ((rtime (decode-time
(time-subtract (timer--time org-timer-countdown-timer)
- nil)))
+ (current-time))))
(rsecs (nth 0 rtime))
(rmins (nth 1 rtime)))
(message "%d minute(s) %d seconds left before next time out"
diff --git a/lisp/org.el b/lisp/org.el
index f24bca2..001923d 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -252,7 +252,7 @@ file to byte-code before it is loaded."
(interactive "fFile to load: \nP")
(let* ((age (lambda (file)
(float-time
- (time-subtract nil
+ (time-subtract (current-time)
(file-attribute-modification-time
(or (file-attributes (file-truename file))
(file-attributes file)))))))
@@ -5645,14 +5645,15 @@ the rounding returns a past time."
(apply 'encode-time
(append (list 0 (* r (floor (+ .5 (/ (float (nth 1 time)) r)))))
(nthcdr 2 time))))
- (if (and past (< (float-time (time-subtract nil res)) 0))
+ (if (and past (< (float-time (time-subtract (current-time) res)) 0))
(seconds-to-time (- (float-time res) (* r 60)))
res))))
(defun org-today ()
"Return today date, considering `org-extend-today-until'."
(time-to-days
- (time-subtract nil (list 0 (* 3600 org-extend-today-until) 0))))
+ (time-subtract (current-time)
+ (list 0 (* 3600 org-extend-today-until) 0))))
;;;; Font-Lock stuff, including the activators
@@ -12857,7 +12858,7 @@ This function is run automatically after each state change to a DONE state."
(let ((nshiftmax 10)
(nshift 0))
(while (or (= nshift 0)
- (not (time-less-p nil time)))
+ (not (time-less-p (current-time) time)))
(when (= nshiftmax (cl-incf nshift))
(or (y-or-n-p
(format "%d repeater intervals were not \