org-after-todo-statistics-hook

org-after-todo-statistics-hook is a variable defined in `org.el'.
Its value is
nil

  • This variable may be risky if used as a file-local variable.

Documentation:
Hook that is called after a TODO statistics cookie has been updated.
Each function is called with two arguments: the number of not-done entries
and the number of done entries.

For example, the following function, when added to this hook, will switch
an entry to DONE when all children are done, and back to TODO when new
entries are set to a TODO status. Note that this hook is only called
when there is a statistics cookie in the headline!

(defun org-summary-todo (n-done n-not-done)
"Switch entry to DONE when all subentries are done, to TODO otherwise."
(let (org-log-done org-log-states) ; turn off logging
(org-todo (if (= n-not-done 0) "DONE" "TODO"))))