* Best way to check if a subtree with a property exists?
@ 2017-12-01 14:00 Kaushal Modi
2017-12-01 15:17 ` Kaushal Modi
0 siblings, 1 reply; 2+ messages in thread
From: Kaushal Modi @ 2017-12-01 14:00 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 961 bytes --]
Hello,
I'd like to check if the current Org file has at least one subtree with a
specific property (EXPORT_FILE_NAME in my case).
What's the most efficient way to do that?
Below works.. but I can see that it's not efficient.. it maps through the
whole Org file:
(let ((total-valid-subtrees
(let ((valid-subtrees (org-map-entries
(lambda ()
t) ;Return value does not matter here
;; Only map through subtrees where
;; EXPORT_FILE_NAME property is not
;; empty.
"EXPORT_FILE_NAME<>\"\"")))
(safe-length valid-subtrees))))
(if (= 0 total-valid-subtrees)
(message "invalid")
(message "valid")))
So,
- How can I quit out of org-map-entries as soon as the first matching entry
is found?
- What's a better way to do the same?
Thanks.
--
Kaushal Modi
[-- Attachment #2: Type: text/html, Size: 1541 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-12-01 15:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-01 14:00 Best way to check if a subtree with a property exists? Kaushal Modi
2017-12-01 15:17 ` Kaushal Modi
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).