Function: org-icalendar-blocked-headline-p
org-icalendar-blocked-headline-p is a byte-compiled function defined
in ox-icalendar.el.gz.
Signature
(org-icalendar-blocked-headline-p HEADLINE INFO)
Documentation
Non-nil when HEADLINE is considered to be blocked.
INFO is a plist used as a communication channel.
A headline is blocked when either
- it has children which are not all in a completed state;
- it has a parent with the property :ORDERED:, and there are
siblings prior to it with incomplete status;
- its parent is blocked because it has siblings that should be
done first or is a child of a blocked grandparent entry.
Source Code
;; Defined in /usr/src/emacs/lisp/org/ox-icalendar.el.gz
(defun org-icalendar-blocked-headline-p (headline info)
"Non-nil when HEADLINE is considered to be blocked.
INFO is a plist used as a communication channel.
A headline is blocked when either
- it has children which are not all in a completed state;
- it has a parent with the property :ORDERED:, and there are
siblings prior to it with incomplete status;
- its parent is blocked because it has siblings that should be
done first or is a child of a blocked grandparent entry."
(or
;; Check if any child is not done.
(org-element-map (org-element-contents headline) 'headline
(lambda (hl) (eq (org-element-property :todo-type hl) 'todo))
info 'first-match)
;; Check :ORDERED: node property.
(catch 'blockedp
(let ((current headline))
(dolist (parent (org-element-lineage headline))
(cond
((not (org-element-property :todo-keyword parent))
(throw 'blockedp nil))
((org-not-nil (org-element-property :ORDERED parent))
(let ((sibling current))
(while (setq sibling (org-export-get-previous-element
sibling info))
(when (eq (org-element-property :todo-type sibling) 'todo)
(throw 'blockedp t)))))
(t (setq current parent))))))))