emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Richard Lawrence <richard.lawrence@berkeley.edu>
To: emacs-orgmode@gnu.org
Subject: Re: org-map-entries and org-map-continue-from
Date: Mon, 28 Feb 2011 20:01:06 -0800	[thread overview]
Message-ID: <871v2ra3r1.fsf@berkeley.edu> (raw)
In-Reply-To: 26658.1298920479@alphaville.dokosmarshall.org

Nick Dokos <nicholas.dokos@hp.com> 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	other threads:[~2011-03-01  3:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-28 18:40 org-map-entries and org-map-continue-from Richard Lawrence
2011-02-28 19:02 ` Nick Dokos
2011-02-28 19:14   ` Nick Dokos
2011-03-01  4:01     ` Richard Lawrence [this message]

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

  List information: https://www.orgmode.org/

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

  git send-email \
    --in-reply-to=871v2ra3r1.fsf@berkeley.edu \
    --to=richard.lawrence@berkeley.edu \
    --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 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).