emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* FR:  count headlines at a level in a region
@ 2007-11-12  0:31 Austin Frank
  2007-11-12  6:36 ` Bastien
  0 siblings, 1 reply; 2+ messages in thread
From: Austin Frank @ 2007-11-12  0:31 UTC (permalink / raw)
  To: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 1147 bytes --]

Hello!

Would it be possible to add a command that does counts the number of
headlines at a particular level in a region or a buffer?

By default the command would count all of the headlines in the buffer or
the region, depending on the selection.  It would also be useful if
prefix arguments restricted the count to headlines at a certain level.

Given the following structure:

 * h1 1
 ** h2 1
 ** h2 2

 * h1 2
 ** h2 3

I would hope for the following behavior from
org-count-headlines-at-level:

 | buffer status          | command         | output      |
 |------------------------+-----------------+-------------|
 | no selection           | no prefix arg   | 5 headlines |
 | no selection           | prefix arg of 1 | 2 headlines |
 | no selection           | prefix arg of 2 | 3 headlines |
 | select the "h1 1" tree | no prefix arg   | 3 headlines |
 | select the "h1 1" tree | prefix arg of 1 | 1 headline  |
 | select the "h1 1" tree | prefix arg of 2 | 2 headlines |

Thanks for considering it!
/au
 
-- 
Austin Frank
http://aufrank.net
GPG Public Key (D7398C2F): http://aufrank.net/personal.asc

[-- Attachment #1.2: Type: application/pgp-signature, Size: 185 bytes --]

[-- Attachment #2: Type: text/plain, Size: 204 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: FR:  count headlines at a level in a region
  2007-11-12  0:31 FR: count headlines at a level in a region Austin Frank
@ 2007-11-12  6:36 ` Bastien
  0 siblings, 0 replies; 2+ messages in thread
From: Bastien @ 2007-11-12  6:36 UTC (permalink / raw)
  To: emacs-orgmode

Austin Frank <austin.frank@gmail.com> writes:

> Would it be possible to add a command that does counts the number of
> headlines at a particular level in a region or a buffer?

May I ask why do you need this?  

Knowing about the context of use for such a function would help figure
out how to write it.

If you just need to know the number of headlines occasionnally, then: 

  C-c C-x b          will open an indirect buffer
  M-x occur "^\*+ "  will find all headlines

But I guess you need to re-use the output of such a function somehow.

-- 
Bastien

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-11-12  5:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-12  0:31 FR: count headlines at a level in a region Austin Frank
2007-11-12  6:36 ` Bastien

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).