From b5a19fcff3962015a24da5c2e143a7d6d183d760 Mon Sep 17 00:00:00 2001 From: ndwarshuis Date: Sun, 20 Feb 2022 10:47:00 -0500 Subject: [PATCH] ADD agenda view for tasks grouped by goal --- local/lib/org-x/org-x-dag.el | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/local/lib/org-x/org-x-dag.el b/local/lib/org-x/org-x-dag.el index 7848f51..d18a3ef 100644 --- a/local/lib/org-x/org-x-dag.el +++ b/local/lib/org-x/org-x-dag.el @@ -1758,7 +1758,7 @@ FUTURE-LIMIT in a list." (let ((parents (org-x-dag-id->parents id))) (-if-let (goal-ids (--filter (member (org-x-dag-id->file it) goal-files) parents)) goal-ids - (-map #'get parents))))) + (-mapcat #'get parents))))) (get id)))) (defun org-x-dag-scan-tasks-with-goals () @@ -2302,5 +2302,20 @@ FUTURE-LIMIT in a list." (lambda (line) (get-text-property 1 'x-day-of-week line))))))))) +(defun org-x-dag-agenda-tasks-by-goal () + (interactive) + (let ((match ''org-x-dag-scan-tasks-with-goals) + (files (org-x-get-action-files))) + (nd/org-agenda-call "Tasks by Goal" nil #'org-x-dag-show-nodes match files + `((org-agenda-todo-ignore-with-date t) + (org-agenda-sorting-strategy '(user-defined-up category-keep)) + (org-super-agenda-groups + '((:auto-map + (lambda (line) + (-if-let (i (get-text-property 1 'x-goal-id line)) + ;; TODO this is the literal ID, I want the headline text + (substring-no-properties i) + "Unlinked"))))))))) + (provide 'org-x-dag) ;;; org-x-dag.el ends here