WIP: Add display-sort-function
This commit is contained in:
parent
28f5aa3100
commit
e030627aeb
1 changed files with 10 additions and 1 deletions
|
|
@ -216,7 +216,16 @@ single predicate)."
|
||||||
(cons 'category 'org-heading)
|
(cons 'category 'org-heading)
|
||||||
(cons 'group-function #'group)
|
(cons 'group-function #'group)
|
||||||
(cons 'affixation-function #'affix)
|
(cons 'affixation-function #'affix)
|
||||||
(cons 'annotation-function #'annotate)))
|
(cons 'annotation-function #'annotate)
|
||||||
|
(cons 'display-sort-function
|
||||||
|
(lambda (strings)
|
||||||
|
(let ((quoted-tokens (mapcar #'regexp-quote query-tokens)))
|
||||||
|
(sort strings
|
||||||
|
(lambda (a b)
|
||||||
|
(cl-labels ((matches
|
||||||
|
(s) (cl-loop for token in quoted-tokens
|
||||||
|
count (string-match-p token s))))
|
||||||
|
(> (matches a) (matches b))))))))))
|
||||||
(`t
|
(`t
|
||||||
;; (debug-message "COLLECTION:t INPUT:%S KEYS:%S"
|
;; (debug-message "COLLECTION:t INPUT:%S KEYS:%S"
|
||||||
;; input (hash-table-keys table))
|
;; input (hash-table-keys table))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue