- publishing free software manuals
The Org Mode 7 Reference Manual
by Carsten Dominik and others
Paperback (6"x9"), 282 pages
ISBN 9781906966089
RRP £9.95 ($14.95)

Sales of this book support the Org project! Get a printed copy>>>

5.5 Breaking tasks down into subtasks

It is often advisable to break down large tasks into smaller, manageable subtasks. You can do this by creating an outline tree below a TODO item, with detailed subtasks on the tree.(44) To keep the overview over the fraction of subtasks that are already completed, insert either ‘[/]’ or ‘[%]’ anywhere in the headline. These cookies will be updated each time the TODO status of a child changes, or when pressing C-c C-c on the cookie. For example:

* Organize Party [33%]
** TODO Call people [1/2]
*** TODO Peter
*** DONE Sarah
** TODO Buy food
** DONE Talk to neighbor

If a heading has both checkboxes and TODO children below it, the meaning of the statistics cookie become ambiguous. Set the property COOKIE_DATA to either ‘checkbox’ or ‘todo’ to resolve this issue.

If you would like to have the statistics cookie count any TODO entries in the subtree (not just direct children), configure the variable org-hierarchical-todo-statistics. To do this for a single subtree, include the word ‘recursive’ into the value of the COOKIE_DATA property.

* Parent capturing statistics [2/20]
  :COOKIE_DATA: todo recursive

If you would like a TODO entry to automatically change to DONE when all children are done, you can use the following setup:

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

(add-hook 'org-after-todo-statistics-hook 'org-summary-todo)

Another possibility is the use of checkboxes to identify (a hierarchy of) a large number of subtasks (see section 5.6 Checkboxes).

ISBN 9781906966089The Org Mode 7 Reference ManualSee the print edition