From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kaushal Modi Subject: Re: Best way to check if a subtree with a property exists? Date: Fri, 01 Dec 2017 15:17:04 +0000 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="001a1142e20624629a055f48dd1c" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:52606) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eKnaA-0003o3-JK for emacs-orgmode@gnu.org; Fri, 01 Dec 2017 10:51:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eKnZY-0003k2-RM for emacs-orgmode@gnu.org; Fri, 01 Dec 2017 10:50:30 -0500 Received: from mail-yw0-x233.google.com ([2607:f8b0:4002:c05::233]:36582) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eKnZY-0003jL-Ln for emacs-orgmode@gnu.org; Fri, 01 Dec 2017 10:49:52 -0500 Received: by mail-yw0-x233.google.com with SMTP id r205so4193297ywb.3 for ; Fri, 01 Dec 2017 07:49:52 -0800 (PST) In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org --001a1142e20624629a055f48dd1c Content-Type: text/plain; charset="UTF-8" On Fri, Dec 1, 2017 at 9:00 AM Kaushal Modi wrote: > - How can I quit out of org-map-entries as soon as the first matching > entry is found? > I think this is much better: (let ((valid-found (catch 'break (org-map-entries (lambda () (throw 'break t)) ;; Only map through subtrees where ;; EXPORT_FILE_NAME property is not ;; empty. "EXPORT_FILE_NAME<>\"\"")))) (message "valid-found: %S" valid-found)) - What's a better way to do the same? > Comments are welcome :) Thanks. -- Kaushal Modi --001a1142e20624629a055f48dd1c Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Fri, Dec 1,= 2017 at 9:00 AM Kaushal Modi <kaushal.modi@gmail.com> wrote:
- How can I quit out of org-map-e= ntries as soon as the first matching entry is found?

I think this is much bet= ter:

(let ((valid-found
=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0 (catch 'break
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 (org-map-entries
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 (lambda ()
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 (throw 'break t))
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0 ;; Only map through subtrees where
=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ;; EXPORT_FILE_NAME property is = not
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ;; empty.
= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 "EXPORT_FILE_NA= ME<>\"\""))))
=C2=A0 (message "valid-found: %S= " valid-found))

- What's a better way to do the same?

Comments are welcome :)
=
Thanks.
--
<= div class=3D"gmail_signature" data-smartmail=3D"gmail_signature">

Kaushal Modi

--001a1142e20624629a055f48dd1c--