File tree 1 file changed +22
-0
lines changed
1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -1150,6 +1150,28 @@ It would be expanded to:
1150
1150
(org-ql--define-query-preamble-fn (reverse org-ql-predicates))
1151
1151
(org-ql--def-query-string-to-sexp-fn (reverse org-ql-predicates))))))
1152
1152
1153
+ (defmacro org-ql-defpred-alias (name args docstring query )
1154
+ " Define an `org-ql' predicate alias to complex `org-ql' query.
1155
+ NAME may be a symbol or a list of symbols: if a list, the first
1156
+ is used as NAME and the rest are aliases.
1157
+
1158
+ ARGS is an argument list. DOCSTRING is the function's docstring.
1159
+
1160
+ QUERY is a valid `org-ql' query."
1161
+ (declare (debug ([&or symbolp listp] listp stringp
1162
+ &rest (sexp query)))
1163
+ (indent defun ))
1164
+ `(org-ql-defpred , name , args
1165
+ , docstring
1166
+ :normalizers ((`(, predicate-names . , arg-values )
1167
+ (cl-progv ', args arg-values
1168
+ (-tree-map
1169
+ (lambda (el )
1170
+ (if (cl-member el ', args )
1171
+ (symbol-value el)
1172
+ el))
1173
+ ', query ))))))
1174
+
1153
1175
(defmacro org-ql--normalize-from-to-on (&rest body )
1154
1176
" For internal use.
1155
1177
Expands into a form that processes arguments to timestamp-related
You can’t perform that action at this time.
0 commit comments