From mboxrd@z Thu Jan 1 00:00:00 1970 From: Richard Lawrence Subject: Re: org-map-entries and org-map-continue-from Date: Mon, 28 Feb 2011 20:01:06 -0800 Message-ID: <871v2ra3r1.fsf@berkeley.edu> References: <87oc5watpj.fsf@berkeley.edu> <26540.1298919759@alphaville.dokosmarshall.org> <26658.1298920479@alphaville.dokosmarshall.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from [140.186.70.92] (port=47342 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PuGhM-0008Ny-Ui for emacs-orgmode@gnu.org; Mon, 28 Feb 2011 22:56:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PuGhL-0001m8-Qv for emacs-orgmode@gnu.org; Mon, 28 Feb 2011 22:56:32 -0500 Received: from lo.gmane.org ([80.91.229.12]:42290) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PuGhL-0001m4-Jv for emacs-orgmode@gnu.org; Mon, 28 Feb 2011 22:56:31 -0500 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1PuGhJ-00021o-QX for emacs-orgmode@gnu.org; Tue, 01 Mar 2011 04:56:29 +0100 Received: from c-67-164-33-170.hsd1.ca.comcast.net ([67.164.33.170]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 01 Mar 2011 04:56:29 +0100 Received: from richard.lawrence by c-67-164-33-170.hsd1.ca.comcast.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 01 Mar 2011 04:56:29 +0100 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Nick Dokos 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