diff options
author | Artur Malabarba <bruce.connor.am@gmail.com> | 2015-01-14 13:26:17 -0200 |
---|---|---|
committer | Artur Malabarba <bruce.connor.am@gmail.com> | 2015-01-14 13:26:17 -0200 |
commit | 4ffa5b9038ee5263702235b8e7923be441548d81 (patch) | |
tree | 1be5e141086216b9e4cf9e590c5fcc28068ad989 /sx-question-print.el | |
parent | 128ec0191ea586f94dfe9b905b29205f6285d50a (diff) | |
parent | 766d008e12d7164053bda6d56f336af442109232 (diff) |
Merge pull request #225 from vermiculus/vermiculus/sort-answers
Sort answers by score
Diffstat (limited to 'sx-question-print.el')
-rw-r--r-- | sx-question-print.el | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/sx-question-print.el b/sx-question-print.el index e120752..737844a 100644 --- a/sx-question-print.el +++ b/sx-question-print.el @@ -179,7 +179,12 @@ QUESTION must be a data structure returned by `json-read'." ;; Print everything (sx-question-mode--print-section question) (sx-assoc-let question - (mapc #'sx-question-mode--print-section .answers)) + (mapc #'sx-question-mode--print-section + (cl-sort .answers + ;; Highest-voted first. @TODO: custom sorting + (lambda (a b) + (> (cdr (assoc 'score a)) + (cdr (assoc 'score b))))))) (insert "\n\n ") (insert-text-button "Write an Answer" :type 'sx-button-answer) ;; Go up |