emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Call org-map-entries just on children?
@ 2011-02-07 17:51 Richard Lawrence
  2011-02-08 15:43 ` Bastien
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Lawrence @ 2011-02-07 17:51 UTC (permalink / raw)
  To: emacs-orgmode

Hi all,

I'm sure I'm just being thick here, but any help would be appreciated...

I want to call org-map-entries in a way that calls a function at each
*child* of the current tree, but not at the current tree itself.  That
is, for some function f, if my Org file looks like this:

* Paper 1
** Student 1
** Student 2
...

I want to call f at "Student 1", "Student 2", etc. but not at "Paper 1".
But if point is positioned at "Paper 1", then

(org-map-entries 'f nil 'tree)

first calls f at the "Paper 1" entry, not the "Student 1" entry.  How
can I apply f just to the *children* of "Paper 1"?

(The reason I need to do this is that f needs to enforce that each of
the children has a value for a certain property, but the parent entry
should not have this property.)

Thanks!

Richard

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

* Re: Call org-map-entries just on children?
  2011-02-07 17:51 Call org-map-entries just on children? Richard Lawrence
@ 2011-02-08 15:43 ` Bastien
  2011-02-08 18:52   ` Richard Lawrence
  0 siblings, 1 reply; 3+ messages in thread
From: Bastien @ 2011-02-08 15:43 UTC (permalink / raw)
  To: Richard Lawrence; +Cc: emacs-orgmode

Hi Richard,

Richard Lawrence <richard.lawrence@berkeley.edu> writes:

> I want to call org-map-entries in a way that calls a function at each
> *child* of the current tree, but not at the current tree itself.  That
> is, for some function f, if my Org file looks like this:
>
> * Paper 1
> ** Student 1
> ** Student 2
> ...
>
> I want to call f at "Student 1", "Student 2", etc. but not at "Paper 1".
> But if point is positioned at "Paper 1", then
>
> (org-map-entries 'f nil 'tree)
>
> first calls f at the "Paper 1" entry, not the "Student 1" entry.  How
> can I apply f just to the *children* of "Paper 1"?

You can simply add 

  (setq org-map-continue-from (outline-next-heading))

at the very beginning of your `f' function.

HTH,

-- 
 Bastien

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

* Re: Call org-map-entries just on children?
  2011-02-08 15:43 ` Bastien
@ 2011-02-08 18:52   ` Richard Lawrence
  0 siblings, 0 replies; 3+ messages in thread
From: Richard Lawrence @ 2011-02-08 18:52 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode

Hi Bastien,

>>  How can I apply f just to the *children* of "Paper 1"?
>
> You can simply add 
>
>   (setq org-map-continue-from (outline-next-heading))
>
> at the very beginning of your `f' function.

Ah, very good.  Thanks so much!

Best,
Richard

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

end of thread, other threads:[~2011-02-08 18:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-07 17:51 Call org-map-entries just on children? Richard Lawrence
2011-02-08 15:43 ` Bastien
2011-02-08 18:52   ` Richard Lawrence

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).