diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index 13bbae966..b3e0dba58 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -5880,12 +5880,12 @@ See also the user option `org-agenda-clock-consistency-checks'." ((> dt (* 60 maxtime)) ;; a very long clocking chunk (setq issue (format "Clocking interval is very long: %s" - (org-duration-from-minutes (floor (/ dt 60.)))) + (org-duration-from-minutes (floor dt 60))) face (or (plist-get pl :long-face) face))) ((< dt (* 60 mintime)) ;; a very short clocking chunk (setq issue (format "Clocking interval is very short: %s" - (org-duration-from-minutes (floor (/ dt 60.)))) + (org-duration-from-minutes (floor dt 60))) face (or (plist-get pl :short-face) face))) ((and (> tlend 0) (< ts tlend)) ;; Two clock entries are overlapping diff --git a/lisp/org-archive.el b/lisp/org-archive.el index 206a76a08..827c9c84b 100644 --- a/lisp/org-archive.el +++ b/lisp/org-archive.el @@ -164,7 +164,7 @@ an error if LOCATION is not a valid archive location." (unless (string-match "::" location) (error "Invalid archive location: %S" location)) (let ((current-file (buffer-file-name (buffer-base-buffer))) - (file-fmt (substring location nil (match-beginning 0))) + (file-fmt (substring location 0 (match-beginning 0))) (heading-fmt (substring location (match-end 0)))) (cons ;; File part. diff --git a/lisp/org-capture.el b/lisp/org-capture.el index debf1808c..cb5b1581b 100644 --- a/lisp/org-capture.el +++ b/lisp/org-capture.el @@ -1003,8 +1003,7 @@ Store them in the capture property list." (equal current-prefix-arg 1)) ;; Prompt for date. (let ((prompt-time (org-read-date - nil t nil "Date for tree entry:" - (current-time)))) + nil t nil "Date for tree entry:"))) (org-capture-put :default-time (cond ((and (or (not (boundp 'org-time-was-given)) diff --git a/lisp/org-clock.el b/lisp/org-clock.el index ea80a3589..cc47e6d44 100644 --- a/lisp/org-clock.el +++ b/lisp/org-clock.el @@ -1169,8 +1169,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 (current-time) - (seconds-to-time org-clock-user-idle-seconds))) + (time-since (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)) (org-clock-resolve @@ -1179,9 +1178,8 @@ so long." (lambda (_) (format "Clocked in & idle for %.1f mins" (/ (float-time - (time-subtract (current-time) - org-clock-user-idle-start)) - 60.0))) + (time-since org-clock-user-idle-start)) + 60))) org-clock-user-idle-start))))) (defvar org-clock-current-task nil "Task currently clocked in.") @@ -1600,7 +1598,7 @@ to, overriding the existing value of `org-clock-out-switch-to-state'." ;; Possibly remove zero time clocks. However, do not add ;; a note associated to the CLOCK line in this case. (cond ((and org-clock-out-remove-zero-time-clocks - (= (+ h m) 0)) + (= 0 h m)) (setq remove t) (delete-region (line-beginning-position) (line-beginning-position 2))) diff --git a/lisp/org-duration.el b/lisp/org-duration.el index e93ef3f12..e350bc74b 100644 --- a/lisp/org-duration.el +++ b/lisp/org-duration.el @@ -316,11 +316,10 @@ When optional argument CANONICAL is non-nil, ignore Raise an error if expected format is unknown." (pcase (or fmt org-duration-format) (`h:mm - (let ((minutes (floor minutes))) - (format "%d:%02d" (/ minutes 60) (mod minutes 60)))) + (format "%d:%02d" (/ minutes 60) (mod minutes 60))) (`h:mm:ss (let* ((whole-minutes (floor minutes)) - (seconds (floor (* 60 (- minutes whole-minutes))))) + (seconds (mod (* 60 minutes) 60))) (format "%s:%02d" (org-duration-from-minutes whole-minutes 'h:mm) seconds))) @@ -401,9 +400,7 @@ Raise an error if expected format is unknown." (pcase-let* ((`(,unit . ,required?) units) (modifier (org-duration--modifier unit canonical))) (cond ((<= modifier minutes) - (let ((value (if (integerp modifier) - (/ (floor minutes) modifier) - (floor (/ minutes modifier))))) + (let ((value (floor minutes modifier))) (cl-decf minutes (* value modifier)) (format " %d%s" value unit))) (required? (concat " 0" unit)) diff --git a/lisp/org-id.el b/lisp/org-id.el index f4c737f0e..e3265db86 100644 --- a/lisp/org-id.el +++ b/lisp/org-id.el @@ -161,9 +161,9 @@ to have no space characters in them." (defcustom org-id-include-domain nil "Non-nil means add the domain name to new IDs. This ensures global uniqueness of IDs, and is also suggested by -RFC 2445 in combination with RFC 822. This is only relevant if -`org-id-method' is `org'. When uuidgen is used, the domain will never -be added. +the relevant RFCs. This is relevant only if `org-id-method' is +`org'. When uuidgen is used, the domain will never be added. + The default is to not use this because we have no really good way to get the true domain, and Org entries will normally not be shared with enough people to make this necessary." diff --git a/lisp/org-macs.el b/lisp/org-macs.el index 4658d5764..eaf65a7d6 100644 --- a/lisp/org-macs.el +++ b/lisp/org-macs.el @@ -1082,8 +1082,8 @@ nil, just return 0." ((stringp s) (condition-case nil (float-time (apply #'encode-time (org-parse-time-string s))) - (error 0.))) - (t 0.))) + (error 0))) + (t 0))) (defun org-time= (a b) (let ((a (org-2ft a)) diff --git a/lisp/org-table.el b/lisp/org-table.el index b409dd422..a52c0b91a 100644 --- a/lisp/org-table.el +++ b/lisp/org-table.el @@ -2272,8 +2272,8 @@ If NLAST is a number, only the NLAST fields will actually be summed." (sres (if (= org-timecnt 0) (number-to-string res) (setq diff (* 3600 res) - h (floor (/ diff 3600)) diff (mod diff 3600) - m (floor (/ diff 60)) diff (mod diff 60) + h (floor diff 3600) diff (mod diff 3600) + m (floor diff 60) diff (mod diff 60) s diff) (format "%.0f:%02.0f:%02.0f" h m s)))) (kill-new sres) diff --git a/lisp/org.el b/lisp/org.el index 9ca6f2df7..6687e9df4 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -15944,8 +15944,8 @@ non-nil." ((org-at-timestamp-p 'lax) (match-string 0)))) ;; 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)))) + (default-time (and ts + (apply #'encode-time (org-parse-time-string ts)))) (default-input (and ts (org-get-compact-tod ts))) (repeater (and ts (string-match "\\([.+-]+[0-9]+[hdwmy] ?\\)+" ts) @@ -15953,13 +15953,13 @@ non-nil." org-time-was-given org-end-time-was-given (time - (and (if (equal arg '(16)) (current-time) - ;; Preserve `this-command' and `last-command'. - (let ((this-command this-command) - (last-command last-command)) - (org-read-date - arg 'totime nil nil default-time default-input - inactive)))))) + (if (equal arg '(16)) (current-time) + ;; Preserve `this-command' and `last-command'. + (let ((this-command this-command) + (last-command last-command)) + (org-read-date + arg 'totime nil nil default-time default-input + inactive))))) (cond ((and ts (memq last-command '(org-time-stamp org-time-stamp-inactive)) @@ -16257,7 +16257,7 @@ user." (when (string-match "\\`[ \t]*\\.[ \t]*\\'" ans) (setq ans "+0")) - (when (setq delta (org-read-date-get-relative ans (current-time) org-def)) + (when (setq delta (org-read-date-get-relative ans nil org-def)) (setq ans (replace-match "" t t ans) deltan (car delta) deltaw (nth 1 delta) @@ -16605,7 +16605,7 @@ Don't touch the rest." If SECONDS is non-nil, return the difference in seconds." (let ((fdiff (if seconds #'float-time #'time-to-days))) (- (funcall fdiff (org-time-string-to-time timestamp-string)) - (funcall fdiff (current-time))))) + (funcall fdiff nil)))) (defun org-deadline-close-p (timestamp-string &optional ndays) "Is the time in TIMESTAMP-STRING close to the current date?" @@ -16787,10 +16787,8 @@ days in order to avoid rounding problems." (match-end (match-end 0)) (time1 (org-time-string-to-time ts1)) (time2 (org-time-string-to-time ts2)) - (t1 (float-time time1)) - (t2 (float-time time2)) - (diff (abs (- t2 t1))) - (negative (< (- t2 t1) 0)) + (diff (abs (float-time (time-subtract time2 time1)))) + (negative (time-less-p time2 time1)) ;; (ys (floor (* 365 24 60 60))) (ds (* 24 60 60)) (hs (* 60 60)) @@ -16801,14 +16799,14 @@ days in order to avoid rounding problems." (fh "%02d:%02d") y d h m align) (if havetime - (setq ; y (floor (/ diff ys)) diff (mod diff ys) + (setq ; y (floor diff ys) diff (mod diff ys) y 0 - d (floor (/ diff ds)) diff (mod diff ds) - h (floor (/ diff hs)) diff (mod diff hs) - m (floor (/ diff 60))) - (setq ; y (floor (/ diff ys)) diff (mod diff ys) + d (floor diff ds) diff (mod diff ds) + h (floor diff hs) diff (mod diff hs) + m (floor diff 60)) + (setq ; y (floor diff ys) diff (mod diff ys) y 0 - d (floor (+ (/ diff ds) 0.5)) + d (round diff ds) h 0 m 0)) (if (not to-buffer) (message "%s" (org-make-tdiff-string y d h m)) diff --git a/lisp/ox-publish.el b/lisp/ox-publish.el index dcd5f2f3a..4bfb021d9 100644 --- a/lisp/ox-publish.el +++ b/lisp/ox-publish.el @@ -793,13 +793,11 @@ Default for SITEMAP-FILENAME is `sitemap.org'." (not (string-lessp B A)))))) ((or `anti-chronologically `chronologically) (let* ((adate (org-publish-find-date a project)) - (bdate (org-publish-find-date b project)) - (A (+ (ash (car adate) 16) (cadr adate))) - (B (+ (ash (car bdate) 16) (cadr bdate)))) + (bdate (org-publish-find-date b project))) (setq retval - (if (eq sort-files 'chronologically) - (<= A B) - (>= A B))))) + (not (if (eq sort-files 'chronologically) + (time-less-p bdate adate) + (time-less-p adate bdate)))))) (`nil nil) (_ (user-error "Invalid sort value %s" sort-files))) ;; Directory-wise wins: