Fix: (ancestors, parent) Normalize sub-queries

I'm not sure why calling the REC labeled function didn't correctly
normalize these sub-queries; it seemed to only normalize for one
round, leaving some queries incorrectly normalized.  But this fixes
it.

Fixes #365.

Reported-by: Gabriele Mongiano <https://github.com/kofm>
This commit is contained in:
Adam Porter 2024-02-21 05:41:49 -06:00
parent b6efba9aeb
commit c90bae0eab
4 changed files with 58 additions and 41 deletions

View file

@ -2077,7 +2077,7 @@ With KEYWORDS, return non-nil if its keyword is one of KEYWORDS."
:normalizers ((`(,predicate-names
;; Avoid infinitely compiling already-compiled functions.
,(and query (guard (not (byte-code-function-p query)))))
`(ancestors ,(org-ql--query-predicate (rec query))))
`(ancestors ,(org-ql--query-predicate (org-ql--normalize-query query))))
(`(,predicate-names) '(ancestors (lambda () t))))
:body
(org-with-wide-buffer
@ -2089,7 +2089,7 @@ With KEYWORDS, return non-nil if its keyword is one of KEYWORDS."
:normalizers ((`(,predicate-names
;; Avoid infinitely compiling already-compiled functions.
,(and query (guard (not (byte-code-function-p query)))))
`(parent ,(org-ql--query-predicate (rec query))))
`(parent ,(org-ql--query-predicate (org-ql--normalize-query query))))
(`(,predicate-names) '(parent (lambda () t))))
:body
(org-with-wide-buffer