Function: org-block-todo-from-checkboxes
org-block-todo-from-checkboxes is a byte-compiled function defined in
org.el.gz.
Signature
(org-block-todo-from-checkboxes CHANGE-PLIST)
Documentation
Block turning an entry into a TODO, using checkboxes.
This checks whether the current task should be blocked from state changes because there are unchecked boxes in this entry.
Source Code
;; Defined in /usr/src/emacs/lisp/org/org.el.gz
(defun org-block-todo-from-checkboxes (change-plist)
"Block turning an entry into a TODO, using checkboxes.
This checks whether the current task should be blocked from state
changes because there are unchecked boxes in this entry."
(if (not org-enforce-todo-checkbox-dependencies)
t ; if locally turned off don't block
(catch 'dont-block
;; If this is not a todo state change, or if this entry is already DONE,
;; do not block
(when (or (not (eq (plist-get change-plist :type) 'todo-state-change))
(member (plist-get change-plist :from)
(cons 'done org-done-keywords))
(member (plist-get change-plist :to)
(cons 'todo org-not-done-keywords))
(not (plist-get change-plist :to)))
(throw 'dont-block t))
;; If this task has checkboxes that are not checked, it's blocked
(save-excursion
(org-back-to-heading t)
(let ((beg (point)) end)
(outline-next-heading)
(setq end (point))
(goto-char beg)
(when (org-list-search-forward
(concat (org-item-beginning-re)
"\\(?:\\[@\\(?:start:\\)?\\([0-9]+\\|[A-Za-z]\\)\\][ \t]*\\)?"
"\\[[- ]\\]")
end t)
(when (boundp 'org-blocked-by-checkboxes)
(setq org-blocked-by-checkboxes t))
(throw 'dont-block nil))))
t))) ; do not block