aboutsummaryrefslogtreecommitdiff
path: root/sx-question-print.el
diff options
context:
space:
mode:
authorSean Allred <code@seanallred.com>2015-01-15 00:09:31 -0500
committerSean Allred <code@seanallred.com>2015-01-15 00:21:28 -0500
commit8e9983d1c9edab01335e3923bb5b50ad5a91ed1f (patch)
tree225eff54c34d5ab40adfe9296d5272871d5988d3 /sx-question-print.el
parent3328a62d42ff3ca62c31366a4cd0cfd38a3ec663 (diff)
Abstract sorting function
Diffstat (limited to 'sx-question-print.el')
-rw-r--r--sx-question-print.el6
1 files changed, 1 insertions, 5 deletions
diff --git a/sx-question-print.el b/sx-question-print.el
index 737844a..210f99a 100644
--- a/sx-question-print.el
+++ b/sx-question-print.el
@@ -180,11 +180,7 @@ QUESTION must be a data structure returned by `json-read'."
(sx-question-mode--print-section question)
(sx-assoc-let question
(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)))))))
+ (cl-sort .answers #'sx-answer-higher-score-p)))
(insert "\n\n ")
(insert-text-button "Write an Answer" :type 'sx-button-answer)
;; Go up