diff --git a/NOTES.org b/NOTES.org index 9a46f27..07d0afa 100644 --- a/NOTES.org +++ b/NOTES.org @@ -159,6 +159,31 @@ - [[#use-macros-for-date][Use macros for date]] :END: +** TODO org-rifle-like predicate + +Seems to work really well. I think it should probably be the default predicate, rather than ~regexp~, because it's so useful and intuitive. + +#+begin_src elisp + (org-ql-defpred (rifle R) (&rest args) + "Docstring" + :preambles ((`(,predicate-names . ,args) + (list :regexp (rx-to-string `(seq bow (or ,@args))) + :case-fold t :query query))) + :body (cl-loop for arg in args + always (or (regexp arg) + (outline-path arg)))) +#+end_src + +That's easily used in the new ~org-ql-find~ command like so: + +#+begin_src elisp + (defun ap/org-ql-rifle () + (interactive) + (org-ql-find (current-buffer) :query-prefix "rifle:" + :query-filter (lambda (string) + (replace-regexp-in-string (rx (1+ space)) "," string t t)))) +#+end_src + ** PROJECT [#B] Sorters with arguments *** TODO Document new sorters @@ -171,6 +196,8 @@ Needs to handle all valid sorting arguments. *** TODO Sorter for tags +*** TODO Sorter for category + *** TODO Sorter for property values :enhancement: :PROPERTIES: :milestone: future