ADD ranking macros

This commit is contained in:
Nathan Dwarshuis 2022-02-09 19:48:26 -05:00
parent ab2bb37152
commit 175b3c0ed8
1 changed files with 21 additions and 0 deletions

View File

@ -703,6 +703,27 @@ FUTURE-LIMIT in a list."
(-> (org-x-dag-format-item id extra category tags this-time) (-> (org-x-dag-format-item id extra category tags this-time)
(org-add-props props)))) (org-add-props props))))
;;; ID FUNCTIONS
;; ranking
(defmacro org-x-dag-ids-rank (form ids)
(declare (indent 1))
`(->> (--map (cons it ,form) ids)
(--sort (> (cdr it) (cdr other)))))
(defmacro org-x-dag-ids-rank-by-children (form ids)
(org-x-dag-ids-rank
(let ((it (org-x-dag-id->children it)))
,form)
ids))
(defmacro org-x-dag-ids-rank-by-parents (form ids)
(org-x-dag-ids-rank
(let ((it (org-x-dag-id->parents it)))
,form)
ids))
;;; HEADLINE PREDICATES ;;; HEADLINE PREDICATES
;; ;;
;; The following are predicates that require the point to be above the ;; The following are predicates that require the point to be above the