all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eric Abrahamsen <eric@ericabrahamsen.net>
To: emacs-orgmode@gnu.org
Subject: Re: Counting number of children under heading
Date: Thu, 17 Apr 2014 18:55:27 +0800	[thread overview]
Message-ID: <871tww444g.fsf@ericabrahamsen.net> (raw)
In-Reply-To: EA9B2D35-1B1F-49EE-9CBE-BAC7B533B9A5@gmail.com

Marvin Doyley <marvinpas@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

  parent reply	other threads:[~2014-04-17 10:52 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-17  9:15 Counting number of children under heading Marvin Doyley
2014-04-17  9:21 ` Bastien
2014-04-17  9:42   ` Thorsten Jolitz
2014-04-18 13:54   ` Sebastien Vauban
2014-04-18 14:50     ` Sacha Chua
2014-04-20 17:28       ` Sebastien Vauban
2014-04-21  2:55         ` Sacha Chua
2014-04-17 10:55 ` Eric Abrahamsen [this message]
2014-04-17 12:02   ` Thorsten Jolitz
2014-04-17 13:10     ` Eric Abrahamsen
  -- strict thread matches above, loose matches on Subject: below --
2014-04-17 13:44 Marvin Doyley
2014-04-17 14:43 ` Thorsten Jolitz
2014-04-17 16:21 Doyley, Marvin M.

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=871tww444g.fsf@ericabrahamsen.net \
    --to=eric@ericabrahamsen.net \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.