aboutsummaryrefslogtreecommitdiff
path: root/sx-question.el
diff options
context:
space:
mode:
authorArtur Malabarba <bruce.connor.am@gmail.com>2015-01-16 13:07:20 -0200
committerArtur Malabarba <bruce.connor.am@gmail.com>2015-01-16 13:07:20 -0200
commit574944fa6ca61ce07e0eb059711ead2b74891e44 (patch)
treefacfe1ef83d2eace51dc170a19e8a1e11e70c90f /sx-question.el
parent7a75cd61e822a4895b85bc17780b163bd6876ca7 (diff)
parent389e433953bba4003b102748dbbf5f8a9b421a51 (diff)
Merge branch 'master' into more-tests
Diffstat (limited to 'sx-question.el')
-rw-r--r--sx-question.el20
1 files changed, 19 insertions, 1 deletions
diff --git a/sx-question.el b/sx-question.el
index 0e830a6..1e3a02c 100644
--- a/sx-question.el
+++ b/sx-question.el
@@ -1,4 +1,4 @@
-;;; sx-question.el --- Base question logic. -*- lexical-binding: t; -*-
+;;; sx-question.el --- question logic -*- lexical-binding: t; -*-
;; Copyright (C) 2014 Sean Allred
@@ -19,6 +19,9 @@
;;; Commentary:
+;; This file provides an API for retrieving questions and defines
+;; additional logic for marking questions as read or hidden.
+
;;; Code:
@@ -184,6 +187,21 @@ If no cache exists for it, initialize one with SITE."
"Formats TAG for display."
(concat "[" tag "]"))
+
+;;; 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