Change: (--query-preamble) Simplify

This commit is contained in:
Adam Porter 2019-07-23 21:32:44 -05:00
parent 6728ddaaa7
commit 06c7f55b21

View file

@ -281,10 +281,9 @@ replace the clause with a preamble."
(pcase element (pcase element
(`(or _) element) (`(or _) element)
(`(regexp . ,regexps) (`(regexp . ,regexps)
(let* ((regexp (rx-to-string `(or ,@regexps) t))) (setq org-ql-preamble (rx-to-string `(or ,@regexps) t))
(setq org-ql-preamble regexp) ;; Return nil
;; Return nil nil)
nil))
(`(todo . ,(and todo-keywords (guard todo-keywords))) (`(todo . ,(and todo-keywords (guard todo-keywords)))
;; FIXME: With case-folding, a query like (todo "WAITING") ;; FIXME: With case-folding, a query like (todo "WAITING")
;; can find a non-todo heading named "Waiting". ;; can find a non-todo heading named "Waiting".
@ -303,9 +302,8 @@ replace the clause with a preamble."
(setq org-ql-preamble (rx-to-string `(seq bol ,repeat " ") t)) (setq org-ql-preamble (rx-to-string `(seq bol ,repeat " ") t))
nil)) nil))
(`(level ,num) (`(level ,num)
(let* ((regexp (rx-to-string `(seq bol (repeat ,num "*") " ") t))) (setq org-ql-preamble (rx-to-string `(seq bol (repeat ,num "*") " ") t))
(setq org-ql-preamble regexp) nil)
nil))
(`(and . ,rest) (`(and . ,rest)
(let ((clauses (mapcar #'rec rest))) (let ((clauses (mapcar #'rec rest)))
`(and ,@(-non-nil clauses)))) `(and ,@(-non-nil clauses))))