WIP: Add tags sorter
This commit is contained in:
parent
3f4bd05a9f
commit
9394152f43
1 changed files with 7 additions and 0 deletions
|
|
@ -2166,6 +2166,13 @@ PREDICATES is a list of one or more sorting methods, including:
|
||||||
(= 0 (random 2))))
|
(= 0 (random 2))))
|
||||||
;; NOTE: reverse and todo are handled below.
|
;; NOTE: reverse and todo are handled below.
|
||||||
;; TODO: Add more.
|
;; 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))))
|
(_ (user-error "Invalid sorting predicate: %s" symbol))))
|
||||||
(sort-by-todo-keyword (items)
|
(sort-by-todo-keyword (items)
|
||||||
(let* ((grouped-items (--group-by (when-let (keyword (org-element-property :todo-keyword it))
|
(let* ((grouped-items (--group-by (when-let (keyword (org-element-property :todo-keyword it))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue