ENH make agenda scanner understand daily nodes (in theory)

This commit is contained in:
Nathan Dwarshuis 2022-04-05 22:47:10 -04:00
parent 757c36fde9
commit d671b9b45e
1 changed files with 38 additions and 27 deletions

View File

@ -1963,17 +1963,18 @@ used for optimization."
((-some->> it-planning (org-ml-get-properties :deadline)) ((-some->> it-planning (org-ml-get-properties :deadline))
(either :left "Daily metablocks cannot be deadlined")) (either :left "Daily metablocks cannot be deadlined"))
((equal it-todo org-x-kw-todo) ((equal it-todo org-x-kw-todo)
(-if-let ((sched-date sched-time) (-some->> it-planning (-if-let (sched (-some->> it-planning
(org-ml-get-property :scheduled) (org-ml-get-property :scheduled)))
(org-ml-timestamp-get-start-time) (-let (((sched-date sched-time) (->> sched
(org-x-dag-datetime-split))) (org-ml-timestamp-get-start-time)
(if (not sched-time) (org-x-dag-datetime-split))))
(either :left "Daily metablocks must have scheduled time") (if (not sched-time)
(-let* (((&plist :tags) node-data) (either :left "Daily metablocks must have scheduled time")
(tag-date (org-x-dag-daily-tags-to-date tags))) (-let* (((&plist :tags) node-data)
(if (org-x-dag-datetime= tag-date sched-date) (tag-date (org-x-dag-daily-tags-to-date tags)))
(either :right `(:active)) (if (org-x-dag-datetime= tag-date sched-date)
(either :left "Daily metablocks must be scheduled within their date")))) (either :right `(:active (:sched ,sched)))
(either :left "Daily metablocks must be scheduled within their date")))))
(either :left "Daily metablocks must be scheduled"))) (either :left "Daily metablocks must be scheduled")))
(t (t
(org-x-dag-bs-error-kw "Daily metablock" it-todo))))) (org-x-dag-bs-error-kw "Daily metablock" it-todo)))))
@ -3498,22 +3499,32 @@ except it ignores inactive timestamps."
(--> datetimes (--> datetimes
(--remove (and donep (not (org-x-dag-datetime= (-take 3 it) sel-date))) it) (--remove (and donep (not (org-x-dag-datetime= (-take 3 it) sel-date))) it)
(if (not todayp) (--remove (org-x-dag-datetime< (-take 3 it) sel-date) it) it) (if (not todayp) (--remove (org-x-dag-datetime< (-take 3 it) sel-date) it) it)
(--map (funcall format-datetime-fun sel-date pos it tags id) it))))))) (--map (funcall format-datetime-fun sel-date pos it tags id) it))))))
(let ((todayp (= (org-x-dag-date-to-absolute sel-date) (org-today)))) (format-scheduleds
;; TODO this won't show daily nodes (todayp sel-date id ts)
(org-x-dag-with-action-ids (format-timestamps todayp sel-date id ts
(pcase (either-from-right (org-x-dag-id->bs it) nil) #'org-x-dag-get-scheduled-at
(`(:sp-task :task-active ,s) #'org-x-dag-format-scheduled-node))
(-let (((&plist :sched :dead) s)) (format-deadlines
(append (todayp sel-date id ts)
(when dead (format-timestamps todayp sel-date id ts
(format-timestamps todayp sel-date it dead #'org-x-dag-get-deadlines-at
#'org-x-dag-get-deadlines-at #'org-x-dag-format-deadline-node)))
#'org-x-dag-format-deadline-node)) (let* ((todayp (= (org-x-dag-date-to-absolute sel-date) (org-today)))
(when sched (action (org-x-dag-with-action-ids
(format-timestamps todayp sel-date it sched (pcase (either-from-right (org-x-dag-id->bs it) nil)
#'org-x-dag-get-scheduled-at (`(:sp-task :task-active ,s)
#'org-x-dag-format-scheduled-node)))))))))) (-let (((&plist :sched :dead) s))
(append
(when dead
(format-deadlines todayp sel-date it dead))
(when sched
(format-scheduleds todayp sel-date it sched))))))))
(daily (org-x-dag-with-file-ids (org-x-dag->planning-file :daily)
(pcase (either-from-right (org-x-dag-id->bs it) nil)
(`(:daily :active ,s)
(format-scheduleds todayp sel-date it sched))))))
(append action daily))))
(defun org-x-dag-scan-quarterly-plan () (defun org-x-dag-scan-quarterly-plan ()
(let ((week-file (list (org-x-get-weekly-plan-file))) (let ((week-file (list (org-x-get-weekly-plan-file)))