ENH include timestamps and stuff in the tasks goal agenda view

This commit is contained in:
Nathan Dwarshuis 2022-02-22 18:49:39 -05:00
parent 3f27f0e839
commit 128feca943
1 changed files with 36 additions and 23 deletions

View File

@ -1791,31 +1791,44 @@ FUTURE-LIMIT in a list."
(--map (format-key it-category nil it) project-tasks) (--map (format-key it-category nil it) project-tasks)
(list (format-key it-category t it)))))) (list (format-key it-category t it))))))
;; TODO this is hella slow...increases runtime by 25% (also super redundant) ;; TODO wetter than Prince's dreams
(defun org-x-dag-id->goals (id)
(let ((goal-files (list (org-x-get-lifetime-goal-file)
(org-x-get-endpoint-goal-file))))
(cl-labels
((get
(id)
(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
(-mapcat #'get parents)))))
(get id))))
(defun org-x-dag-scan-tasks-with-goals () (defun org-x-dag-scan-tasks-with-goals ()
(cl-flet (cl-flet
((split-parent-goals ((format-key
(s) (category is-standalone key)
(let ((id (get-text-property 1 'x-id s))) (let ((tags (org-x-dag-id->tags t nil key)))
;; ASSUME all foreign parents are actually goals ;; filter out incubators
;; TODO this isn't a great assumption (org-x-dag-with-id key
(-if-let (goal-ids (org-x-dag-id->foreign-parents id)) (unless (member org-x-tag-incubated tags)
(--map (org-add-props s nil 'x-goal-id it) goal-ids) (let* ((s (org-x-headline-get-task-status-0 (org-x-dag-id->todo key)))
(list (org-add-props s nil 'x-goal-id nil)))))) (p (alist-get s org-x-headline-task-status-priorities)))
(->> (org-x-dag-scan-tasks) (unless (= p -1)
(-mapcat #'split-parent-goals)))) (let ((item
(-> (org-x-dag-format-tag-node category tags key)
(org-add-props nil
'x-is-standalone is-standalone
'x-status s))))
(-if-let (goal-ids (org-x-dag-id->foreign-parents key))
(--map (org-add-props item nil 'x-goal-id it) goal-ids)
(list (org-add-props item nil 'x-goal-id nil)))))))))))
(org-x-dag-with-files (org-x-get-action-files)
(org-x-dag-id->is-toplevel-p it)
(-if-let (project-tasks (org-x-dag-get-task-nodes it))
(--mapcat (format-key it-category nil it) project-tasks)
(format-key it-category t it)))))
;; (defun org-x-dag-scan-tasks-with-goals ()
;; (cl-flet
;; ((split-parent-goals
;; (s)
;; (let ((id (get-text-property 1 'x-id s)))
;; ;; ASSUME all foreign parents are actually goals
;; ;; TODO this isn't a great assumption
;; (-if-let (goal-ids (org-x-dag-id->foreign-parents id))
;; (--map (org-add-props s nil 'x-goal-id it) goal-ids)
;; (list (org-add-props s nil 'x-goal-id nil))))))
;; (->> (org-x-dag-scan-tasks)
;; (-mapcat #'split-parent-goals))))
(defun org-x-dag-scan-incubated () (defun org-x-dag-scan-incubated ()
(cl-flet (cl-flet