From 2d7d83aff5cfbcb561e241af88639403e0a948c0 Mon Sep 17 00:00:00 2001 From: ndwarshuis Date: Sun, 13 Mar 2022 11:02:07 -0400 Subject: [PATCH] ADD toplevel goal status function --- local/lib/org-x/org-x-dag.el | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/local/lib/org-x/org-x-dag.el b/local/lib/org-x/org-x-dag.el index e443464..eb5fd64 100644 --- a/local/lib/org-x/org-x-dag.el +++ b/local/lib/org-x/org-x-dag.el @@ -2041,6 +2041,19 @@ return another status." ((or :complete :archivable) 2)))) (org-x-dag-endpoint-status id deadline :active)))))))))) +(defun org-x-dag-toplevel-goal-status (id) + (org-x-dag-status-valid id :toplevel-goal)) + +(defun org-x-dag-id->toplevel-goal-status (id) + (-if-let (err (or (org-x-dag-id->illegal-link-error id) + (org-x-dag-id->created-error id) + (when (org-x-dag-id->metaprop :planning id) + "Toplevel goals cannot have planning elements.") + (unless (equal org-x-kw-todo (org-x-dag-id->todo id)) + "Toplevel goals can only be TODO"))) + (org-x-dag-status-error id general-error) + (org-x-dag-toplevel-goal-status id))) + (defun org-x-dag-id->file-level-status (id) "Return file-level status of ID and its children.