ENH update archive functions to properly display iterators

This commit is contained in:
Nathan Dwarshuis 2022-06-05 13:15:27 -04:00
parent 1fc1f34df8
commit d1ffcee540
1 changed files with 38 additions and 27 deletions

View File

@ -2584,12 +2584,13 @@ Return value is a list like (BUFFER NON-BUFFER)."
"Return t if ID has no buffer children." "Return t if ID has no buffer children."
(not (org-x-dag-id->buffer-children id))) (not (org-x-dag-id->buffer-children id)))
(defun org-x-dag-id->is-active-iterator-child-p (id) (defun org-x-dag-id->is-active-toplevel-iterator-child-p (id)
(-> (org-x-dag-id->buffer-parent id) (-when-let (parent (org-x-dag-id->buffer-parent id))
(org-x-dag-id->bs) (-when-let (parent-bs (-> (org-x-dag-id->bs parent)
(either-from-right nil) (either-from-right nil)))
(cadr) (pcase (plist-get (cdr parent-bs) :local)
(eq :iter-active))) (`(:sp-iter :iter-nonempty :nonempty-active ,_)
(org-x-dag-id->is-toplevel-p parent))))))
(defun org-x-dag-id->has-node-property-p (prop value id) (defun org-x-dag-id->has-node-property-p (prop value id)
(->> (alist-get prop (org-x-dag-id->node-properties id) nil nil #'equal) (->> (alist-get prop (org-x-dag-id->node-properties id) nil nil #'equal)
@ -3299,25 +3300,33 @@ FUTURE-LIMIT in a list."
(defun org-x-dag-itemize-archived (files) (defun org-x-dag-itemize-archived (files)
(org-x-dag-with-unmasked-action-ids files (org-x-dag-with-unmasked-action-ids files
(-let (((comptime type) (-when-let (r (pcase it-local
(pcase it-local (`(:sp-proj :proj-complete ,c)
(`(:sp-proj :proj-complete ,c) `(,c :proj)) (when (org-x-dag-id->is-toplevel-p it)
(`(:sp-task :task-complete ,c) `(,c :task)) `(,c :proj)))
(`(:sp-iter :iter-complete ,c) `(,c :iter)) (`(:sp-task :task-complete ,c)
(`(:sp-subiter :si-complete ,c) `(,c :subiter))))) (when (org-x-dag-id->is-toplevel-p it)
(when (and comptime `(,c :task)))
(or (and (memq type '(:proj :task)) (`(:sp-iter :iter-empty :empty-complete ,c)
(org-x-dag-id->is-toplevel-p it)) (when (org-x-dag-id->is-toplevel-p it)
(eq type :iter) `(,c :iter-empty)))
(and (eq type :subiter) (`(:sp-iter :iter-nonempty :nonempty-complete ,c)
(org-x-dag-id->is-active-iterator-child-p it)))) (when (org-x-dag-id->is-toplevel-p it)
(-let ((epoch (plist-get comptime :epoch))) `(,c :iter-nonempty)))
(`(:sp-subiter :si-proj :proj-complete ,c)
(when (org-x-dag-id->is-active-toplevel-iterator-child-p it)
`(,c :subiter-proj)))
(`(:sp-subiter :si-task :task-complete ,c)
(when (org-x-dag-id->is-active-toplevel-iterator-child-p it)
`(,c :subiter-task)))))
(-let* (((comptime type) r)
(epoch (plist-get comptime :epoch)))
(when (org-x-dag-time-is-archivable-p epoch) (when (org-x-dag-time-is-archivable-p epoch)
(let ((tags (org-x-dag-id->tags it))) (let ((tags (org-x-dag-id->tags it)))
(-> (org-x-dag-format-tag-node tags it) (-> (org-x-dag-format-tag-node tags it)
(org-add-props nil (org-add-props nil
'x-type type) 'x-type type)
(list))))))))) (list))))))))
(defun org-x-dag-itemize-errors (files) (defun org-x-dag-itemize-errors (files)
(cl-flet (cl-flet
@ -5204,8 +5213,10 @@ review phase)"
(cl-case (get-text-property 1 'x-type line) (cl-case (get-text-property 1 'x-type line)
(:proj "Toplevel Projects") (:proj "Toplevel Projects")
(:task "Standalone Tasks") (:task "Standalone Tasks")
(:iter "Closed Iterators") (:iter-empty "Closed Empty Iterators")
(:subiter "Toplevel Subiterators")))))))))) (:iter-nonempty "Closed Active Iterators")
(:subiter-proj "Toplevel Subiterator Projects")
(:subiter-task "Toplevel Subiterator Tasks"))))))))))
;; ;; TODO the tags in the far column are redundant ;; ;; TODO the tags in the far column are redundant
;; (defun org-x-dag-agenda-quarterly-plan () ;; (defun org-x-dag-agenda-quarterly-plan ()