From 96d9f84df051d83abd668120369ea9ef57abdc6b Mon Sep 17 00:00:00 2001 From: ndwarshuis Date: Tue, 10 May 2022 17:46:51 -0400 Subject: [PATCH] ENH filter quarterly plan nodes with no network status --- etc/conf.org | 2 +- local/lib/org-x/org-x-dag.el | 55 ++++++++++++++++++------------------ 2 files changed, 29 insertions(+), 28 deletions(-) diff --git a/etc/conf.org b/etc/conf.org index 62ae28f..050534a 100644 --- a/etc/conf.org +++ b/etc/conf.org @@ -2986,7 +2986,7 @@ original function being advised and ARGS are the arguments." ;; (advice-add #'org-agenda-run-series :around #'org-x-agenda-run-series-advice) ;; hide the daily tags -(setq org-agenda-hide-tags-regexp "[DMYQ][0-9]\\{2\\}") +(setq org-agenda-hide-tags-regexp "[DMYQ][0-9]\\{1,2\\}") ;; (advice-remove #'org-agenda-run-series #'org-x-agenda-run-series-advice) (org-x-dag-set-series-advice t) diff --git a/local/lib/org-x/org-x-dag.el b/local/lib/org-x/org-x-dag.el index 165923f..62fc6e5 100644 --- a/local/lib/org-x/org-x-dag.el +++ b/local/lib/org-x/org-x-dag.el @@ -2035,7 +2035,6 @@ If FORCE is non-nil, sync no matter what." (setq org-x-dag-sync-state)) nil)) - ;; GLOBAL LOOKUP FUNCTIONS ;; all functions with `org-x-dag->' or `org-x-dag-id->' depend on the value of @@ -2930,22 +2929,24 @@ FUTURE-LIMIT in a list." (let* ((wkp-ids (org-x-dag->current-wkp-ids)) (sel-date (org-x-dag->selected-date)) (q-date (org-x-dag-date-to-quarter-start sel-date))) - (org-x-dag-with-ids files - (pcase (either-from-right (org-x-dag-id->bs it) nil) - (`(:quarterly :active ,dead) - (let* ((tags (org-x-dag-id->tags it)) - (date (org-x-dag-quarter-tags-to-date tags))) - (when (org-x-dag-datetime= q-date date) - (-when-let (ns (org-x-dag-id->ns it)) - (-let (((&plist :planned p :committed c :scheduled-actions s) - (either-from-right ns nil))) + (cl-flet + ((map-ns + (ns) + (-let (((&plist :planned p :committed c :scheduled-actions s) ns)) + (list (-intersection p wkp-ids) c s)))) + (org-x-dag-with-ids files + (pcase (either-from-right (org-x-dag-id->bs it) nil) + (`(:quarterly :active ,dead) + (let* ((tags (org-x-dag-id->tags it)) + (date (org-x-dag-quarter-tags-to-date tags))) + (when (org-x-dag-datetime= q-date date) + (let ((ns (-some-> (org-x-dag-id->ns it) + (either-from (-const nil) #'map-ns)))) ;; TODO actually handle deadlines (-> (org-x-dag-format-tag-node tags it) (org-add-props nil 'x-deadline dead - 'x-scheduled s - 'x-plannedp (-intersection p wkp-ids) - 'x-committedp c) + 'x-network-status ns) (list))))))))))) ;; TODO not DRY @@ -4720,21 +4721,21 @@ In the order of display (org-super-agenda-groups '((:auto-map (lambda (line) - (-let* ((c (get-text-property 1 'x-committedp line)) - (p (get-text-property 1 'x-plannedp line)) - (s (get-text-property 1 'x-scheduled line)) + (-let* ((ns (get-text-property 1 'x-network-status line)) ((rank text) - (cond - ((and s c) - '(5 "Committed | Scheduled")) - ((and p c) - '(4 "Committed | Planned")) - ((and (not p) c) - '(3 "Committed | Unplanned")) - ((and p (not c)) - '(2 "Uncommitted | Planned")) - (t - '(1 "Unfulfilled | Unplanned"))))) + (if (not ns) '(0 "No Network Status") + (-let (((p s c) ns)) + (cond + ((and s c) + '(5 "Committed | Scheduled")) + ((and p c) + '(4 "Committed | Planned")) + ((and (not p) c) + '(3 "Committed | Unplanned")) + ((and p (not c)) + '(2 "Uncommitted | Planned")) + (t + '(1 "Unfulfilled | Unplanned"))))))) (format "%d. %s" rank text)))))))))) (defun org-x-dag-agenda-weekly-plan ()