I'm wondering if there is a good method of counting subheadings of a particular heading in org-mode. For example, with the following, return 4
(non-recursively) or 7
(recursively). Note that I don't want to use keywords (ex: TODO
) and [/]
syntax (http://stackoverflow.com/questions/13372550/orgmode-show-number-of-children-under-heading); I just want to calculate it programmatically using elisp.
I'm hoping that I'm just missing a useful org function. Otherwise I may resort to counting results of a regex search using the outline patterns of levels ^\\*{n}
bounded by the heading and org-forward-heading-same-level
. This is messy and I'd like to do it the "org way" in case org mode ever ignores heading patterns found in source blocks or edge cases I haven't considered.