diff options
author | Artur Malabarba <bruce.connor.am@gmail.com> | 2015-02-26 16:07:56 -0300 |
---|---|---|
committer | Artur Malabarba <bruce.connor.am@gmail.com> | 2015-02-26 16:07:56 -0300 |
commit | cb93e1d242e866f9bd862880ecbcfceaec16ecd9 (patch) | |
tree | e6527e0f8dace4f6320e2ace329abfbe85ddc8ea /sx-question-print.el | |
parent | 7ef768bce7a943a55774f225022d8883c95a523f (diff) | |
parent | d9a6666b13fb15361580354d8d865b2555d843bb (diff) |
Merge pull request #259 from vermiculus/bind-answer-sorting-to-a-key
Bind answer sorting to a key
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 6c85d5f..c350d8c 100644 --- a/sx-question-print.el +++ b/sx-question-print.el @@ -148,13 +148,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) (defcustom sx-question-mode-use-images |