Fix: Compound queries with preamble

Bug was introduced in b5ccc32.
This commit is contained in:
Adam Porter 2019-08-08 08:29:26 -05:00
parent 4db4e411a0
commit c4531b25a4
2 changed files with 14 additions and 6 deletions

View file

@ -416,12 +416,11 @@ If NARROW is non-nil, buffer will not be widened."
(when (org-before-first-heading-p)
(outline-next-heading))
;; `cl-loop' makes this double-while much clearer than the expanded form.
(cond (preamble-re (cl-loop while (and (when (re-search-forward preamble-re nil t)
(outline-back-to-heading 'invisible-ok)
t)
(funcall predicate))
(cond (preamble-re (cl-loop while (re-search-forward preamble-re nil t)
do (outline-back-to-heading 'invisible-ok)
when (funcall predicate)
collect (funcall action)
while (outline-next-heading)))
do (outline-next-heading)))
(t (cl-loop when (funcall predicate)
collect (funcall action)
while (outline-next-heading)))))))

View file

@ -459,7 +459,16 @@ Based on Buttercup macro `it'."
(expect (org-ql test-buffer
(ts :on "2019-06-09")
:action (org-ql-test-org-get-heading))
:to-equal nil)))))
:to-equal nil)))
(describe "Compound queries"
(org-ql-it "Tags and to-do"
(expect (org-ql test-buffer
(and (todo "SOMEDAY")
(tags "Emacs"))
:action (org-ql-test-org-get-heading))
:to-equal '("Rewrite Emacs in Common Lisp"))))))
;; Local Variables:
;; truncate-lines: t