summaryrefslogtreecommitdiff
path: root/lisp/org
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/org')
-rw-r--r--lisp/org/org-agenda.el14
-rw-r--r--lisp/org/org-capture.el5
-rw-r--r--lisp/org/org-clock.el58
-rw-r--r--lisp/org/org-colview.el4
-rw-r--r--lisp/org/org-macro.el2
-rw-r--r--lisp/org/org-table.el4
-rw-r--r--lisp/org/org.el70
7 files changed, 73 insertions, 84 deletions
diff --git a/lisp/org/org-agenda.el b/lisp/org/org-agenda.el
index 6cc5214306a..d491dff4779 100644
--- a/lisp/org/org-agenda.el
+++ b/lisp/org/org-agenda.el
@@ -5491,8 +5491,8 @@ displayed in agenda view."
(substring
(format-time-string
(car org-time-stamp-formats)
- (apply #'encode-time ; DATE bound by calendar
- (list 0 0 0 (nth 1 date) (car date) (nth 2 date))))
+ (encode-time ; DATE bound by calendar
+ 0 0 0 (nth 1 date) (car date) (nth 2 date)))
1 11))
"\\|\\(<[0-9]+-[0-9]+-[0-9]+[^>\n]+?\\+[0-9]+[hdwmy]>\\)"
"\\|\\(<%%\\(([^>\n]+)\\)>\\)"))
@@ -5742,8 +5742,8 @@ then those holidays will be skipped."
(substring
(format-time-string
(car org-time-stamp-formats)
- (apply 'encode-time ; DATE bound by calendar
- (list 0 0 0 (nth 1 date) (car date) (nth 2 date))))
+ (encode-time ; DATE bound by calendar
+ 0 0 0 (nth 1 date) (car date) (nth 2 date)))
1 11))))
(org-agenda-search-headline-for-time nil)
marker hdmarker priority category level tags closedp
@@ -5860,10 +5860,8 @@ See also the user option `org-agenda-clock-consistency-checks'."
(throw 'next t))
(setq ts (match-string 1)
te (match-string 3)
- ts (float-time
- (apply #'encode-time (org-parse-time-string ts)))
- te (float-time
- (apply #'encode-time (org-parse-time-string te)))
+ ts (float-time (org-time-string-to-time ts))
+ te (float-time (org-time-string-to-time te))
dt (- te ts))))
(cond
((> dt (* 60 maxtime))
diff --git a/lisp/org/org-capture.el b/lisp/org/org-capture.el
index a699d2e28fc..0c7f159369f 100644
--- a/lisp/org/org-capture.el
+++ b/lisp/org/org-capture.el
@@ -1009,9 +1009,8 @@ Store them in the capture property list."
(not (= (time-to-days prompt-time) (org-today))))
;; Use 00:00 when no time is given for another
;; date than today?
- (apply #'encode-time
- (append '(0 0 0)
- (cl-cdddr (decode-time prompt-time)))))
+ (apply #'encode-time 0 0 0
+ (cl-cdddr (decode-time prompt-time))))
((string-match "\\([^ ]+\\)--?[^ ]+[ ]+\\(.*\\)"
org-read-date-final-answer)
;; Replace any time range by its start.
diff --git a/lisp/org/org-clock.el b/lisp/org/org-clock.el
index b177450d33f..babf1f70669 100644
--- a/lisp/org/org-clock.el
+++ b/lisp/org/org-clock.el
@@ -723,8 +723,8 @@ menu\nmouse-2 will jump to task"))
The time returned includes the time spent on this task in
previous clocking intervals."
(let ((currently-clocked-time
- (floor (- (float-time)
- (float-time org-clock-start-time)) 60)))
+ (floor (encode-time (time-subtract nil org-clock-start-time) 'integer)
+ 60)))
(+ currently-clocked-time (or org-clock-total-time 0))))
(defun org-clock-modify-effort-estimate (&optional value)
@@ -1033,8 +1033,9 @@ to be CLOCKED OUT."))))
nil 45)))
(and (not (memq char-pressed '(?i ?q))) char-pressed)))))
(default
- (floor (/ (float-time
- (time-subtract (current-time) last-valid)) 60)))
+ (floor (encode-time (time-subtract (current-time) last-valid)
+ 'integer)
+ 60))
(keep
(and (memq ch '(?k ?K))
(read-number "Keep how many minutes? " default)))
@@ -1102,8 +1103,8 @@ If `only-dangling-p' is non-nil, only ask to resolve dangling
(lambda (clock)
(format
"Dangling clock started %d mins ago"
- (floor (- (float-time)
- (float-time (cdr clock)))
+ (floor (encode-time (time-subtract nil (cdr clock))
+ 'integer)
60)))))
(or last-valid
(cdr clock)))))))))))
@@ -1293,8 +1294,7 @@ the default behavior."
(setq ts (concat "[" (match-string 1) "]"))
(goto-char (match-end 1))
(setq org-clock-start-time
- (apply 'encode-time
- (org-parse-time-string (match-string 1))))
+ (org-time-string-to-time (match-string 1)))
(setq org-clock-effort (org-entry-get (point) org-effort-property))
(setq org-clock-total-time (org-clock-sum-current-item
(org-clock-get-sum-start))))
@@ -1431,7 +1431,7 @@ The time is always returned as UTC."
(day (nth 3 dt)))
(if (< hour org-extend-today-until) (setf (nth 3 dt) (1- day)))
(setf (nth 2 dt) org-extend-today-until)
- (apply #'encode-time (append (list 0 0) (nthcdr 2 dt)))))
+ (apply #'encode-time 0 0 (nthcdr 2 dt))))
((or (equal cmt "all")
(and (or (not cmt) (equal cmt "auto"))
(not lr)))
@@ -1577,14 +1577,12 @@ to, overriding the existing value of `org-clock-out-switch-to-state'."
(delete-region (point) (point-at-eol))
(insert "--")
(setq te (org-insert-time-stamp (or at-time now) 'with-hm 'inactive))
- (setq s (- (float-time
- (apply #'encode-time (org-parse-time-string te)))
- (float-time
- (apply #'encode-time (org-parse-time-string ts))))
- h (floor (/ s 3600))
+ (setq s (float-time (time-subtract
+ (org-time-string-to-time te)
+ (org-time-string-to-time ts)))
+ h (floor s 3600)
s (- s (* 3600 h))
- m (floor (/ s 60))
- s (- s (* 60 s)))
+ m (floor s 60))
(insert " => " (format "%2d:%02d" h m))
(move-marker org-clock-marker nil)
(move-marker org-clock-hd-marker nil)
@@ -1813,15 +1811,15 @@ PROPNAME lets you set a custom text property instead of :org-clock-minutes."
((match-end 2)
;; Two time stamps.
(let* ((ts (float-time
- (apply #'encode-time
- (save-match-data
- (org-parse-time-string (match-string 2))))))
+ (encode-time
+ (save-match-data
+ (org-parse-time-string (match-string 2))))))
(te (float-time
- (apply #'encode-time
- (org-parse-time-string (match-string 3)))))
+ (encode-time
+ (org-parse-time-string (match-string 3)))))
(dt (- (if tend (min te tend) te)
(if tstart (max ts tstart) ts))))
- (when (> dt 0) (cl-incf t1 (floor (/ dt 60))))))
+ (when (> dt 0) (cl-incf t1 (floor dt 60)))))
((match-end 4)
;; A naked time.
(setq t1 (+ t1 (string-to-number (match-string 5))
@@ -2704,14 +2702,14 @@ LEVEL is an integer. Indent by two spaces per level above 1."
(pcase-let ((`(,month ,day ,year) (calendar-gregorian-from-absolute ts)))
(setq ts (float-time (encode-time 0 0 0 day month year)))))
(ts
- (setq ts (float-time (apply #'encode-time (org-parse-time-string ts))))))
+ (setq ts (float-time (org-time-string-to-time ts)))))
(cond
((numberp te)
;; Likewise for te.
(pcase-let ((`(,month ,day ,year) (calendar-gregorian-from-absolute te)))
(setq te (float-time (encode-time 0 0 0 day month year)))))
(te
- (setq te (float-time (apply #'encode-time (org-parse-time-string te))))))
+ (setq te (float-time (org-time-string-to-time te)))))
(setq tsb
(if (eq step0 'week)
(let ((dow (nth 6 (decode-time (encode-time ts)))))
@@ -2720,7 +2718,7 @@ LEVEL is an integer. Indent by two spaces per level above 1."
ts))
(while (< tsb te)
(unless (bolp) (insert "\n"))
- (let ((start-time (encode-time (max tsb ts))))
+ (let ((start-time (max tsb ts)))
(cl-incf tsb (let ((dow (nth 6 (decode-time (encode-time tsb)))))
(if (or (eq step0 'day)
(= dow ws))
@@ -2882,18 +2880,16 @@ Otherwise, return nil."
(<= org-clock-marker (point-at-eol)))
;; The clock is running here
(setq org-clock-start-time
- (apply 'encode-time
- (org-parse-time-string (match-string 1))))
+ (org-time-string-to-time (match-string 1)))
(org-clock-update-mode-line)))
(t
(and (match-end 4) (delete-region (match-beginning 4) (match-end 4)))
(end-of-line 1)
(setq ts (match-string 1)
te (match-string 3))
- (setq s (- (float-time
- (apply #'encode-time (org-parse-time-string te)))
- (float-time
- (apply #'encode-time (org-parse-time-string ts))))
+ (setq s (float-time
+ (time-subtract (org-time-string-to-time te)
+ (org-time-string-to-time ts)))
neg (< s 0)
s (abs s)
h (floor (/ s 3600))
diff --git a/lisp/org/org-colview.el b/lisp/org/org-colview.el
index 2c34eddcf6b..f3e118b6dea 100644
--- a/lisp/org/org-colview.el
+++ b/lisp/org/org-colview.el
@@ -719,7 +719,7 @@ around it."
(setq time-after (copy-sequence time))
(setf (nth 3 time-before) (1- (nth 3 time)))
(setf (nth 3 time-after) (1+ (nth 3 time)))
- (mapcar (lambda (x) (format-time-string fmt (apply 'encode-time x)))
+ (mapcar (lambda (x) (format-time-string fmt (encode-time x)))
(list time-before time time-after)))))
(defun org-columns-open-link (&optional arg)
@@ -1070,7 +1070,7 @@ as a canonical duration, i.e., using units defined in
(cond
((string-match-p org-ts-regexp s)
(/ (- org-columns--time
- (float-time (apply #'encode-time (org-parse-time-string s))))
+ (float-time (org-time-string-to-time s)))
60))
((org-duration-p s) (org-duration-to-minutes s t)) ;skip user units
(t (user-error "Invalid age: %S" s))))
diff --git a/lisp/org/org-macro.el b/lisp/org/org-macro.el
index 7d04d02970c..a151e1e8469 100644
--- a/lisp/org/org-macro.el
+++ b/lisp/org/org-macro.el
@@ -313,7 +313,7 @@ Return a list of arguments, as strings. This is the opposite of
(buffer-substring
(point) (line-end-position)))))
(when (cl-some #'identity time)
- (setq date (apply #'encode-time time))))))))
+ (setq date (encode-time time))))))))
(let ((proc (get-buffer-process buf)))
(while (and proc (accept-process-output proc .5 nil t)))))
(kill-buffer buf))
diff --git a/lisp/org/org-table.el b/lisp/org/org-table.el
index 0a8382c8b56..81a77fde6c7 100644
--- a/lisp/org/org-table.el
+++ b/lisp/org/org-table.el
@@ -2909,8 +2909,8 @@ location of point."
(format-time-string
(org-time-stamp-format
(string-match-p "[0-9]\\{1,2\\}:[0-9]\\{2\\}" ts))
- (apply #'encode-time
- (save-match-data (org-parse-time-string ts))))))
+ (encode-time
+ (save-match-data (org-parse-time-string ts))))))
form t t))
(setq ev (if (and duration (string-match "^[0-9]+:[0-9]+\\(?::[0-9]+\\)?$" form))
diff --git a/lisp/org/org.el b/lisp/org/org.el
index 91a4799a21a..b627282a63d 100644
--- a/lisp/org/org.el
+++ b/lisp/org/org.el
@@ -5613,16 +5613,15 @@ When ROUNDING-MINUTES is not an integer, fall back on the car of
the rounding returns a past time."
(let ((r (or (and (integerp rounding-minutes) rounding-minutes)
(car org-time-stamp-rounding-minutes)))
- (time (decode-time)) res)
+ (now (current-time)))
(if (< r 1)
- (current-time)
- (setq res
- (apply 'encode-time
- (append (list 0 (* r (floor (+ .5 (/ (float (nth 1 time)) r)))))
- (nthcdr 2 time))))
- (if (and past (< (float-time (time-subtract (current-time) res)) 0))
- (encode-time (- (float-time res) (* r 60)))
- res))))
+ now
+ (let* ((time (decode-time now))
+ (res (apply #'encode-time 0 (* r (round (nth 1 time) r))
+ (nthcdr 2 time))))
+ (if (or (not past) (time-less-p res now))
+ res
+ (time-subtract res (* r 60)))))))
(defun org-today ()
"Return today date, considering `org-extend-today-until'."
@@ -9743,9 +9742,7 @@ active region."
(setq link
(format-time-string
(car org-time-stamp-formats)
- (apply 'encode-time
- (list 0 0 0 (nth 1 cd) (nth 0 cd) (nth 2 cd)
- nil nil nil))))
+ (encode-time 0 0 0 (nth 1 cd) (nth 0 cd) (nth 2 cd))))
(org-store-link-props :type "calendar" :date cd)))
((eq major-mode 'help-mode)
@@ -13344,7 +13341,7 @@ for calling org-schedule with, or if there is no scheduling,
returns nil."
(let ((time (org-entry-get pom "SCHEDULED" inherit)))
(when time
- (apply 'encode-time (org-parse-time-string time)))))
+ (org-time-string-to-time time))))
(defun org-get-deadline-time (pom &optional inherit)
"Get the deadline as a time tuple, of a format suitable for
@@ -13352,7 +13349,7 @@ calling org-deadline with, or if there is no scheduling, returns
nil."
(let ((time (org-entry-get pom "DEADLINE" inherit)))
(when time
- (apply 'encode-time (org-parse-time-string time)))))
+ (org-time-string-to-time time))))
(defun org-remove-timestamp-with-keyword (keyword)
"Remove all time stamps with KEYWORD in the current entry."
@@ -13411,7 +13408,7 @@ WHAT entry will also be removed."
org-deadline-time-regexp)
end t)
(setq ts (match-string 1)
- default-time (apply 'encode-time (org-parse-time-string ts))
+ default-time (org-time-string-to-time ts)
default-input (and ts (org-get-compact-tod ts)))))))
(when what
(setq time
@@ -14668,7 +14665,7 @@ it as a time string and apply `float-time' to it. If S is nil, just return 0."
((numberp s) s)
((stringp s)
(condition-case nil
- (float-time (apply #'encode-time (org-parse-time-string s)))
+ (float-time (org-time-string-to-time s))
(error 0.)))
(t 0.)))
@@ -14676,8 +14673,7 @@ it as a time string and apply `float-time' to it. If S is nil, just return 0."
"Time in seconds today at 0:00.
Returns the float number of seconds since the beginning of the
epoch to the beginning of today (00:00)."
- (float-time (apply 'encode-time
- (append '(0 0 0) (nthcdr 3 (decode-time))))))
+ (float-time (apply #'encode-time 0 0 0 (nthcdr 3 (decode-time)))))
(defun org-matcher-time (s)
"Interpret a time comparison value."
@@ -16573,7 +16569,7 @@ non-nil."
;; Default time is either the timestamp at point or today.
;; When entering a range, only the range start is considered.
(default-time (if (not ts) (current-time)
- (apply #'encode-time (org-parse-time-string ts))))
+ (org-time-string-to-time ts)))
(default-input (and ts (org-get-compact-tod ts)))
(repeater (and ts
(string-match "\\([.+-]+[0-9]+[hdwmy] ?\\)+" ts)
@@ -16820,7 +16816,7 @@ user."
(when (< (nth 2 org-defdecode) org-extend-today-until)
(setf (nth 2 org-defdecode) -1)
(setf (nth 1 org-defdecode) 59)
- (setq org-def (apply #'encode-time org-defdecode))
+ (setq org-def (encode-time org-defdecode))
(setq org-defdecode (decode-time org-def)))
(let* ((timestr (format-time-string
(if org-with-time "%Y-%m-%d %H:%M" "%Y-%m-%d")
@@ -16893,13 +16889,14 @@ user."
"range representable on this machine"))
(ding))
- ;; One round trip to get rid of 34th of August and stuff like that....
- (setq final (decode-time (apply 'encode-time final)))
+ (setq final (apply #'encode-time final))
(setq org-read-date-final-answer ans)
(if to-time
- (apply 'encode-time final)
+ final
+ ;; This round-trip gets rid of 34th of August and stuff like that....
+ (setq final (decode-time final))
(if (and (boundp 'org-time-was-given) org-time-was-given)
(format "%04d-%02d-%02d %02d:%02d"
(nth 5 final) (nth 4 final) (nth 3 final)
@@ -16929,7 +16926,7 @@ user."
(and (boundp 'org-time-was-given) org-time-was-given))
(cdr fmts)
(car fmts)))
- (txt (format-time-string fmt (apply 'encode-time f)))
+ (txt (format-time-string fmt (apply #'encode-time f)))
(txt (if org-read-date-inactive (concat "[" (substring txt 1 -1) "]") txt))
(txt (concat "=> " txt)))
(when (and org-end-time-was-given
@@ -17296,7 +17293,7 @@ The command returns the inserted time stamp."
time (org-fix-decoded-time t1)
str (org-add-props
(format-time-string
- (substring tf 1 -1) (apply 'encode-time time))
+ (substring tf 1 -1) (encode-time time))
nil 'mouse-face 'highlight))
(put-text-property beg end 'display str)))
@@ -17553,7 +17550,7 @@ days in order to avoid rounding problems."
(defun org-time-string-to-time (s)
"Convert timestamp string S into internal time."
- (apply #'encode-time (org-parse-time-string s)))
+ (encode-time (org-parse-time-string s)))
(defun org-time-string-to-seconds (s)
"Convert a timestamp string S into a number of seconds."
@@ -17588,7 +17585,7 @@ signaled."
(daynr (org-closest-date s daynr prefer))
(t (time-to-days
(condition-case errdata
- (apply #'encode-time (org-parse-time-string s))
+ (org-time-string-to-time s)
(error (error "Bad timestamp `%s'%s\nError was: %s"
s
(if (not (and buffer pos)) ""
@@ -17686,12 +17683,12 @@ stamp stay unchanged. In any case, return value is an absolute
day number."
(if (not (string-match "\\+\\([0-9]+\\)\\([hdwmy]\\)" start))
;; No repeater. Do not shift time stamp.
- (time-to-days (apply #'encode-time (org-parse-time-string start)))
+ (time-to-days (org-time-string-to-time start))
(let ((value (string-to-number (match-string 1 start)))
(type (match-string 2 start)))
(if (= 0 value)
;; Repeater with a 0-value is considered as void.
- (time-to-days (apply #'encode-time (org-parse-time-string start)))
+ (time-to-days (org-time-string-to-time start))
(let* ((base (org-date-to-gregorian start))
(target (org-date-to-gregorian current))
(sday (calendar-absolute-from-gregorian base))
@@ -18000,7 +17997,7 @@ When SUPPRESS-TMP-DELAY is non-nil, suppress delays like \"--2d\"."
(setcar time0 (or (car time0) 0))
(setcar (nthcdr 1 time0) (or (nth 1 time0) 0))
(setcar (nthcdr 2 time0) (or (nth 2 time0) 0))
- (setq time (apply 'encode-time time0))))
+ (setq time (encode-time time0))))
;; Insert the new time-stamp, and ensure point stays in the same
;; category as before (i.e. not after the last position in that
;; category).
@@ -23389,13 +23386,12 @@ strictly within a source block, use appropriate comment syntax."
(defun org-timestamp--to-internal-time (timestamp &optional end)
"Encode TIMESTAMP object into Emacs internal time.
Use end of date range or time range when END is non-nil."
- (apply #'encode-time
- (cons 0
- (mapcar
- (lambda (prop) (or (org-element-property prop timestamp) 0))
- (if end '(:minute-end :hour-end :day-end :month-end :year-end)
- '(:minute-start :hour-start :day-start :month-start
- :year-start))))))
+ (apply #'encode-time 0
+ (mapcar
+ (lambda (prop) (or (org-element-property prop timestamp) 0))
+ (if end '(:minute-end :hour-end :day-end :month-end :year-end)
+ '(:minute-start :hour-start :day-start :month-start
+ :year-start)))))
(defun org-timestamp-has-time-p (timestamp)
"Non-nil when TIMESTAMP has a time specified."