aboutsummaryrefslogtreecommitdiff
path: root/sx-question.el
diff options
context:
space:
mode:
Diffstat (limited to 'sx-question.el')
-rw-r--r--sx-question.el18
1 files changed, 17 insertions, 1 deletions
diff --git a/sx-question.el b/sx-question.el
index 35eabc8..1fde1aa 100644
--- a/sx-question.el
+++ b/sx-question.el
@@ -148,7 +148,8 @@ See `sx-question--user-read-list'."
;; Question wasn't present.
(t
(sx-sorted-insert-skip-first
- q-cell site-cell (lambda (x y) (> (car x) (car y))))))))
+ q-cell site-cell
+ (lambda (x y) (> (or (car x) -1) (or (car y) -1))))))))
;; Save the results.
;; @TODO This causes a small lag on `j' and `k' as the list gets
;; large. Should we do this on a timer?
@@ -207,6 +208,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