Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

1 Answer 1

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

Documentation:
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 [%]
:PROPERTIES:
:COOKIE_DATA: recursive
:END:
** 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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.