ENH start repeaters at current time and not selected time

This commit is contained in:
Nathan Dwarshuis 2022-05-07 19:14:09 -04:00
parent 1000246135
commit af50a3e8ff
1 changed files with 19 additions and 12 deletions

View File

@ -2490,14 +2490,13 @@ encountered will be returned."
;; (DST, leap year, different days in each month, etc). Think of this like ;; (DST, leap year, different days in each month, etc). Think of this like
;; a path function from p-chem; shifting 3 months once might be different ;; a path function from p-chem; shifting 3 months once might be different
;; than shifting by 1 month three times. ;; than shifting by 1 month three times.
(->> (list t datetime) (->> `(nil . ,datetime)
(--unfold (--unfold
(-let (((pastp datetime) it)) (unless (car it)
(print pastp) (let* ((next (org-x-dag-datetime-shift (cdr it) shift shifttype))
(when pastp (futurep (org-x-dag-datetime< sel-datetime next)))
(let* ((next (org-x-dag-datetime-shift datetime shift shifttype)) ;; (futurep (org-x-dag-date< sel-datetime next)))
(pastp (org-x-dag-datetime< next sel-datetime))) `(,next . (,futurep . ,next)))))
`(,next . (,pastp ,next))))))
(-last-item))) (-last-item)))
('restart ('restart
;; Next time is one repeater interval after now ;; Next time is one repeater interval after now
@ -2527,9 +2526,13 @@ FUTURE-LIMIT in a list."
(defun org-x-dag-get-scheduled-at (sel-date pts) (defun org-x-dag-get-scheduled-at (sel-date pts)
(-let* (((&plist :datetime d :repeater r) pts) (-let* (((&plist :datetime d :repeater r) pts)
(islongp (org-ml-time-is-long d)) (islongp (org-ml-time-is-long d))
(future-limit (if islongp `(,@sel-date 23 59) sel-date)) ((future-limit sel-datetime cur)
(sel-datetime (if islongp (org-x-dag-date-at-current-time sel-date) sel-date))) (if islongp
(org-x-dag-unfold-timestamp sel-datetime d r future-limit))) `((,@sel-date 23 59)
,(org-x-dag-date-at-current-time sel-date)
,(org-x-dag-current-datetime))
`(,sel-date ,sel-date ,(org-x-dag-current-date)))))
(org-x-dag-unfold-timestamp cur d r future-limit)))
(defun org-x-dag-get-deadlines-at (sel-date pts) (defun org-x-dag-get-deadlines-at (sel-date pts)
(-let* (((&plist :datetime d :repeater r :warning w) pts) (-let* (((&plist :datetime d :repeater r :warning w) pts)
@ -2538,9 +2541,13 @@ FUTURE-LIMIT in a list."
(if w w (if w w
(let ((f (if islongp 1440 1))) (let ((f (if islongp 1440 1)))
`(,(* f org-deadline-warning-days) submonth)))) `(,(* f org-deadline-warning-days) submonth))))
(sel-datetime (if islongp (org-x-dag-date-at-current-time sel-date) sel-date)) ((sel-datetime cur)
(if islongp
`(,(org-x-dag-date-at-current-time sel-date)
,(org-x-dag-current-datetime))
`(,sel-date ,(org-x-dag-current-date))))
(future-limit (org-x-dag-datetime-shift sel-datetime warn-shift warn-shifttype))) (future-limit (org-x-dag-datetime-shift sel-datetime warn-shift warn-shifttype)))
(org-x-dag-unfold-timestamp sel-datetime d r future-limit))) (org-x-dag-unfold-timestamp cur d r future-limit)))
(defun org-x-dag-id->marker (id &optional point) (defun org-x-dag-id->marker (id &optional point)