Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to do something like this in Emacs' Org-mode:

* headline [%]
** subheadline1 [%]
   - [ ] list item 1
   - [ ] list item 2
** subheadline2 [%]
   - [ ] list item 1
   - [ ] list item 2

The purpose here is to have the percentage cookie at headline present the total percentage of completed tasks computed from the percentage cookies of its subheadlines.

If "subheadline1" is at 40%, and "subheadline2" is at 50%, then "headline" should be at (40 + 50) / 2 = 45 % (2 is the number of subheadlines).

Is it possible? If so, how?

share|improve this question
its not clear (at least for me) what you want. what you want to achieve finally from that template? – kindahero Jan 19 '12 at 8:28
@kindahero Posted a more elaborate explanation. – EpsilonVector Jan 19 '12 at 9:49

I don't think that is entirely possible at the moment. Checkboxes deal with their children only by default as a complete/incomplete cookie. (See Checkboxes). However if you follow footnote 57 there is the option to use org-hierarchical-checkbox-statistics and include all checkboxes in the headline, not just direct children.

So by adding or evaluating

(setq org-hierarchical-checkbox-statistics nil)

You can set this feature (count all checkboxes in tree, recursively) for all org-files.

If you want to set it for specific trees only, the docstring provides the answer:

org-hierarchical-checkbox-statistics is a variable defined in `org-list.el'.
Its value is t

Non-nil means checkbox statistics counts only the state of direct children.
When nil, all boxes below the cookie are counted.
This can be set to nil on a per-node basis using a COOKIE_DATA property
with the word "recursive" in the value.

In this case your example would become:

* headline [%]
:COOKIE_DATA: recursive
** subheadline1 [%]
   - [ ] list item 1
   - [ ] list item 2
** subheadline2 [%]
   - [ ] list item 1
   - [ ] list item 2

To use your further example:
Subheadline 1 = 2/4 = 50%
Subheadline 2 = 2/5 = 45%
Headline 1 = 4/9 = 44.44%

share|improve this answer
Is it expected that it notworks right now ? (I use the COOKIE_DATA recursive property and it stays at 0/0 instead of expected 2/8) – Nikana Reklawyks Jun 2 at 21:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .