1
0
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-11-22 07:09:47 +00:00

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>
This commit is contained in:
Kyle Meyer 2019-01-31 22:54:38 -05:00
parent bf9bf7a174
commit af7795533a
6 changed files with 26 additions and 15 deletions

View File

@ -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)))))

View File

@ -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

View File

@ -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)))

View File

@ -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)

View File

@ -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"

View File

@ -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 \