diff options
author | Artur Malabarba <bruce.connor.am@gmail.com> | 2015-02-12 14:59:46 -0200 |
---|---|---|
committer | Artur Malabarba <bruce.connor.am@gmail.com> | 2015-02-12 15:01:59 -0200 |
commit | 85109b7dd2ffb896151ccef2c014c7d9ea33e682 (patch) | |
tree | 704e430265af6ea381fe167c39767f511603925f /sx-question-print.el | |
parent | 78cc17295c255dc188c96ea7a401ee9a915b9269 (diff) |
Define possible values for answer sorting
Diffstat (limited to 'sx-question-print.el')
-rw-r--r-- | sx-question-print.el | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/sx-question-print.el b/sx-question-print.el index 778b580..4f50560 100644 --- a/sx-question-print.el +++ b/sx-question-print.el @@ -153,13 +153,24 @@ replaced with the comment." :type 'boolean :group 'sx-question-mode) +(defconst sx-question-mode--sort-methods + (let ((methods + '(("Higher-scoring" . sx-answer-higher-score-p) + ("Newer" . sx-answer-newer-p) + ("More active" . sx-answer-more-active-p)))) + (append (mapcar (lambda (x) (cons (concat (car x) " first") (cdr x))) + methods) + (mapcar (lambda (x) (cons (concat (car x) " last") + (sx--invert-predicate (cdr x)))) + methods)))) + (defcustom sx-question-mode-answer-sort-function #'sx-answer-higher-score-p "Function used to sort answers in the question buffer." - :type '(choice - (const :tag "Higher-scoring first" sx-answer-higher-score-p) - (const :tag "Newer first" sx-answer-newer-p) - (const :tag "More active first" sx-answer-more-active-p)) + :type + (cons 'choice + (mapcar (lambda (x) `(const :tag ,(car x) ,(cdr x))) + sx-question-mode--sort-methods)) :group 'sx-question-mode) |