Change: (children, descendants) Return after finding one match
A simple optimization that can be significant in large subtrees.
This commit is contained in:
parent
e839397579
commit
802bc462d6
1 changed files with 12 additions and 4 deletions
12
org-ql.el
12
org-ql.el
|
|
@ -661,8 +661,12 @@ Or, when possible, fix the problem."
|
|||
(funcall ,query)))
|
||||
(t `(and (level ,level)
|
||||
,query)))))
|
||||
(catch 'found
|
||||
(org-ql-select (current-buffer)
|
||||
query :narrow t :action (lambda () t)))))))
|
||||
query
|
||||
:narrow t
|
||||
:action (lambda ()
|
||||
(throw 'found t)))))))))
|
||||
|
||||
(org-ql--defpred descendants (query)
|
||||
"Return non-nil if current entry has descendants matching QUERY."
|
||||
|
|
@ -670,8 +674,12 @@ Or, when possible, fix the problem."
|
|||
(save-restriction
|
||||
(org-narrow-to-subtree)
|
||||
(when (org-goto-first-child)
|
||||
(catch 'found
|
||||
(org-ql-select (current-buffer)
|
||||
query :narrow t :action (lambda () t))))))
|
||||
query
|
||||
:narrow t
|
||||
:action (lambda ()
|
||||
(throw 'found t))))))))
|
||||
|
||||
(org-ql--defpred category (&rest categories)
|
||||
"Return non-nil if current heading is in one or more of CATEGORIES (a list of strings)."
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue