This commit is contained in:
Ihor Radchenko 2025-05-04 23:59:42 +00:00 committed by GitHub
commit 35be030463
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1279,6 +1279,28 @@ It would be expanded to:
(org-ql--define-query-preamble-fn (reverse org-ql-predicates))
(org-ql--def-query-string-to-sexp-fn (reverse org-ql-predicates))))))
(defmacro org-ql-defpred-alias (name args docstring query)
"Define an `org-ql' predicate alias to complex `org-ql' query.
NAME may be a symbol or a list of symbols: if a list, the first
is used as NAME and the rest are aliases.
ARGS is an argument list. DOCSTRING is the function's docstring.
QUERY is a valid `org-ql' query."
(declare (debug ([&or symbolp listp] listp stringp
&rest (sexp query)))
(indent defun))
`(org-ql-defpred ,name ,args
,docstring
:normalizers ((`(,predicate-names . ,arg-values)
(cl-progv ',args arg-values
(-tree-map
(lambda (el)
(if (cl-member el ',args)
(symbol-value el)
el))
',query))))))
(defmacro org-ql--normalize-from-to-on (&rest body)
"For internal use.
Expands into a form that processes arguments to timestamp-related