Marvin Doyley <marvin...@gmail.com> writes: > Hi there, > > I would like to automatically count the number of children under a given > heading. For example, I would like to have > > * Cars (2) > ** BMW > ** Escort > > Putting [/] at the end of header (in this case Cars), then putting the TODO > keyword before each sub-header give me a partial solution > > * Cars [/] > ** TODO BMW > ** TODO Escort > > > Is there way to do this without using the TODO keyword ? > > Thanks, > M
I could have sworn someone posted a thing for this just a week or two ago, using `org-map-entries' and the identity function, and counting the results. Anyway look at the docstring for `org-map-entries', it takes a SCOPE argument you can set to 'tree to just map the headings under the current one. A stupid example might look like: (apply '+ (org-map-entries (lambda () 1) t 'tree)) Though that will count the top-level heading, as well. E