ENH skip children under CANC/HOLD for projects

This commit is contained in:
Nathan Dwarshuis 2021-04-21 01:00:13 -04:00
parent 26081cad6d
commit b1d116a5bf
2 changed files with 19 additions and 24 deletions

View File

@ -2666,23 +2666,18 @@ original org entry before executing BODY."
(org-super-agenda-groups
`((:auto-map
,(nd/org-x-mk-super-agenda-pred
;; TODO this ain't DRY
(let* ((status (org-x-get-project-status))
(priority (alist-get status nd/org-x-project-status-priorities))
(is-subproject (org-x-headline-has-parent 'org-x-is-todoitem-p))
;; skip anything that is in a CANC or HOLD project
(is-masked (when is-subproject
(or (org-x-is-todo-child org-x-kw-canc)
(org-x-is-todo-child org-x-kw-hold)))))
(unless (or is-masked (< priority 0))
(--> status
(symbol-name it)
(substring it 1)
(s-replace "-" " " it)
(s-titleize it)
(concat "%s.%s " it)
(format it (if is-subproject 1 0) priority)
(concat it (if is-subproject " (σ)" " (τ)")))))))
(priority (alist-get status nd/org-x-project-status-priorities)))
(unless (< priority 0)
(let* ((is-subproject (org-x-headline-has-task-parent))
(level (if is-subproject 1 0))
(subtitle (if is-subproject "σ" "τ"))
(fmt (format "%s.%s %%s (%s)" level priority subtitle)))
(->> (symbol-name status)
(s-chop-prefix ":")
(s-replace "-" " ")
(s-titleize)
(format fmt)))))))
(:discard (:anything t))))))))
("i"

View File

@ -231,7 +231,7 @@
"Defines the order in which todo keywords should be sorted.")
(defconst org-x-project-skip-todostates
'(org-x-kw-hold org-x-kw-canc)
(list org-x-kw-hold org-x-kw-canc)
"These keywords override all contents within their subtrees.
Currently used to tell skip functions when they can hop over
entire subtrees to save time and ignore tasks")
@ -1366,7 +1366,11 @@ If ARG is non-nil use long timestamp format."
((or (org-x-is-iterator-heading-p) (org-x-is-periodical-heading-p))
(org-x-skip-subtree))
((not (org-x-is-project-p))
(org-x-skip-heading)))))
(org-x-skip-heading))
((org-x-headline-has-parent
(lambda ()
(member (org-get-todo-state) org-x-project-skip-todostates)))
(org-x-skip-children)))))
(defun org-x-incubator-skip-function ()
(org-with-wide-buffer
@ -1391,9 +1395,7 @@ If ARG is non-nil use long timestamp format."
((not (org-x-is-periodical-heading-p))
(org-x-skip-heading))
((org-x-headline-has-parent #'org-x-is-periodical-heading-p)
;; TODO this can be made faster by skipping to the next headline one
;; level up
(org-x-skip-heading)))))
(org-x-skip-children)))))
(defun org-x-iterator-skip-function ()
(org-with-wide-buffer
@ -1401,9 +1403,7 @@ If ARG is non-nil use long timestamp format."
((not (org-x-is-iterator-heading-p))
(org-x-skip-heading))
((org-x-headline-has-parent #'org-x-is-iterator-heading-p)
;; TODO this can be made faster by skipping to the next headline one
;; level up
(org-x-skip-heading)))))
(org-x-skip-children)))))
(defun org-x-error-skip-function ()
(org-with-wide-buffer