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

View File

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