Skip to content

Commit

Permalink
Feat: Enable all valid priority values
Browse files Browse the repository at this point in the history
Expand recognised priority values from A-C to current org-mode
standard of A-Z and 0-64. Futher work is required to use
`org-get-priority-function` and support custom priority values.
  • Loading branch information
ComedyTomedy committed Oct 10, 2024
1 parent b6f8a31 commit 94a7a44
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions org-ql.el
Original file line number Diff line number Diff line change
Expand Up @@ -1735,15 +1735,14 @@ priority B)."
`(priority ',comparator ,letter)))

:preambles
(;; NOTE: This only accepts A, B, or C. I haven't seen
;; other priorities in the wild, so this will do for now.
(`(,predicate-names)
((`(,predicate-names)
;; Any priority cookie.
(list :regexp (rx-to-string `(seq bol (1+ "*") (1+ blank) (0+ nonl) "[#" (in "ABC") "]") t)))
(`(,predicate-names ,(and (or ''= ''< ''> ''<= ''>=) comparator) ,letter)
;; Comparator and priority letter.
(list :regexp (rx-to-string `(seq bol (1+ "*") (1+ blank) (0+ nonl) "[#" (or (in "A-Z") (1+ (in "0-9"))) "]") t)))
;; NOTE: The double-quoted comparators. See below.
(let* ((priority-letters '("A" "B" "C"))
(let* ((priority-letters (append (mapcar #'number-to-string (number-sequence 0 64))
(mapcar #'string (number-sequence ?A ?Z))))
(index (-elem-index letter priority-letters))
;; NOTE: Higher priority == lower number.
;; NOTE: Because we need to support both preamble-based queries and
Expand Down

0 comments on commit 94a7a44

Please sign in to comment.