aboutsummaryrefslogtreecommitdiff
path: root/sx-question.el
diff options
context:
space:
mode:
authorArtur Malabarba <bruce.connor.am@gmail.com>2015-01-16 13:30:58 -0200
committerArtur Malabarba <bruce.connor.am@gmail.com>2015-01-16 13:30:58 -0200
commit006c85d3a241e20b6b03ab4499dbc467f8431ddd (patch)
tree4799ce852da6e4308080669aa577906ef56f8bbc /sx-question.el
parentbed5191a0137cb115656baf6ae3535b2a646d0b2 (diff)
parent389e433953bba4003b102748dbbf5f8a9b421a51 (diff)
Merge branch 'master' into tag-buttons
Conflicts: sx-question.el
Diffstat (limited to 'sx-question.el')
-rw-r--r--sx-question.el15
1 files changed, 14 insertions, 1 deletions
diff --git a/sx-question.el b/sx-question.el
index 0f73795..039d416 100644
--- a/sx-question.el
+++ b/sx-question.el
@@ -176,13 +176,26 @@ If no cache exists for it, initialize one with SITE."
;;;; Other data
-
(defun sx-question--accepted-answer-id (question)
"Return accepted answer in QUESTION or nil if none exists."
(sx-assoc-let question
(and (integerp .accepted_answer_id)
.accepted_answer_id)))
+
+;;; Question Mode Answer-Sorting Functions
+(sx--create-comparator sx-answer-higher-score-p
+ "Return t if answer A has a higher score than answer B."
+ #'> (lambda (x) (cdr (assq 'score x))))
+
+(sx--create-comparator sx-answer-newer-p
+ "Return t if answer A was posted later than answer B."
+ #'> (lambda (x) (cdr (assq 'creation_date x))))
+
+(sx--create-comparator sx-answer-more-active-p
+ "Return t if answer A was updated after answer B."
+ #'> (lambda (x) (cdr (assq 'last_activity_date x))))
+
(provide 'sx-question)
;;; sx-question.el ends here