From 59ae74ef5aee1b91d64ae2b99c86f9940f7f7512 Mon Sep 17 00:00:00 2001 From: ndwarshuis Date: Mon, 28 Feb 2022 18:23:09 -0500 Subject: [PATCH] ENH don't allow survival goals to be linked to endpoint --- local/lib/org-x/org-x-dag.el | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/local/lib/org-x/org-x-dag.el b/local/lib/org-x/org-x-dag.el index 75732e9..1f4f291 100644 --- a/local/lib/org-x/org-x-dag.el +++ b/local/lib/org-x/org-x-dag.el @@ -2159,13 +2159,15 @@ FUTURE-LIMIT in a list." (--map (format-key it-category it))) (list (format-key it-category it))))))) -(defun org-x-dag--classify-goal-link (which id) +(defun org-x-dag--classify-goal-link (which which-goal id) (let ((f (org-x-dag-id->file id))) (cond ((member f (org-x-dag->action-files)) :action) ((equal f (org-x-dag->goal-file which)) :local) + ((and which-child (equal f (org-x-dag->goal-file which-child))) + :child-goal) ((equal f (org-x-dag->planning-file :quarterly)) :plan) (t @@ -2182,18 +2184,20 @@ FUTURE-LIMIT in a list." :goal-parents goal-parents :invalid-parents invalid-parents))) -(defun org-x-dag-scan-toplevel-goals (which) +(defun org-x-dag-scan-toplevel-goals (which which-goal) (cl-flet ((format-id (category id) (-let* (((buffer linked) (org-x-dag-id->split-children id)) - ((&alist :action :local :plan :other) - (--group-by (org-x-dag--classify-goal-link which it) linked)) + ((&alist :action :local :child-goal :plan :other) + (--group-by + (org-x-dag--classify-goal-link which which-child it) + linked)) (tags (org-x-dag-id->tags nil id))) (-> (org-x-dag-format-tag-node category tags id) (org-x-dag--add-goal-status which (append buffer local) - action + (append action child-goal) other))))) (org-x-dag-with-files (list (org-x-dag->goal-file which)) nil @@ -2201,8 +2205,7 @@ FUTURE-LIMIT in a list." (list (format-id it-category it)))))) (defun org-x-dag-scan-epgs () - (let ((parent-files `(,(org-x-dag->goal-file :lifetime) - ,(org-x-dag->goal-file :survival)))) + (let ((parent-files `(,(org-x-dag->goal-file :lifetime)))) (cl-flet ((format-id (category id) @@ -2228,8 +2231,8 @@ FUTURE-LIMIT in a list." (list (format-id it-category it))))))) (defun org-x-dag-scan-goals () - (append (org-x-dag-scan-toplevel-goals :lifetime) - (org-x-dag-scan-toplevel-goals :survival) + (append (org-x-dag-scan-toplevel-goals :lifetime :endpoint) + (org-x-dag-scan-toplevel-goals :survival nil) (org-x-dag-scan-epgs))) (defun org-x-dag-scan-errors ()