emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] org-map-entries and org-map-continue-from


From: Richard Lawrence
Subject: Re: [O] org-map-entries and org-map-continue-from
Date: Mon, 28 Feb 2011 20:01:06 -0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)

Nick Dokos <address@hidden> writes:

> The problem is that org-entry-get does not just look forward: it looks
> *around* and finds the property when point is both at the beginning
> and at the end of the headline "Four", so you get "four" twice.

Ah, so that's the culprit.  Thanks!

> Maybe this?
>
> #+BEGIN_SRC emacs-lisp
>   (defun get-export-filenames ()
>     (interactive)
>     (setq export-files '())
>     (progn
>       (org-map-entries
>        (lambda ()
>          (setq org-map-continue-from (outline-next-heading))
>          (if org-map-continue-from
>              (let ((org-trust-scanner-tags t))
>                (push (org-entry-get (point) "EXPORT_FILE_NAME") 
> export-files))))
>          nil 'tree)
>        (message export-files))) ; errors, but lets me see the list of 
> collected values
>   
> #+END_SRC

Indeed, that does seem to work: outline-next-heading returns nil if it
doesn't find a next heading, and a buffer location otherwise (at least
that's the way it looks based on some tests; the documentation doesn't
say, and I didn't crack open the code).  So wrapping the rest of the
lambda body in (if org-map-continue-from ...) prevents it from executing
that one last time.

Thanks for your help, Nick!

Best,
Richard




reply via email to

[Prev in Thread] Current Thread [Next in Thread]