From 9394152f4313d3fdc28c97026168957d7ba6c52b Mon Sep 17 00:00:00 2001 From: Adam Porter Date: Sun, 20 Mar 2022 19:14:45 -0500 Subject: [PATCH] WIP: Add tags sorter --- org-ql.el | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/org-ql.el b/org-ql.el index 9f42d06..deefcf6 100644 --- a/org-ql.el +++ b/org-ql.el @@ -2166,6 +2166,13 @@ PREDICATES is a list of one or more sorting methods, including: (= 0 (random 2)))) ;; NOTE: reverse and todo are handled below. ;; TODO: Add more. + (`(tags . ,tags) (lambda (a b) + "Return non-nil if A has certain tags and B doesn't." + (cl-flet ((test-entry + (entry) (org-with-point-at (org-element-property :org-hd-marker entry) + (apply #'org-ql--predicate-tags tags)))) + (and (test-entry a) + (not (test-entry b)))))) (_ (user-error "Invalid sorting predicate: %s" symbol)))) (sort-by-todo-keyword (items) (let* ((grouped-items (--group-by (when-let (keyword (org-element-property :todo-keyword it))