aboutsummaryrefslogtreecommitdiff
path: root/sx-question-mode.el
diff options
context:
space:
mode:
authorArtur Malabarba <bruce.connor.am@gmail.com>2015-02-26 22:19:05 -0300
committerArtur Malabarba <bruce.connor.am@gmail.com>2015-02-26 22:19:05 -0300
commit7df79a35edcb79e7caca4a0d50fcec54d5f68fef (patch)
treecc2bcb61f4350dce6a5b5ecba12218f25645275f /sx-question-mode.el
parent83538b215f75256b86987b999504a2d87d0db307 (diff)
parentf4ba0e2a11581477e412c276080a049d19351361 (diff)
Merge branch 'master' into question-mode-line
Diffstat (limited to 'sx-question-mode.el')
-rw-r--r--sx-question-mode.el13
1 files changed, 13 insertions, 0 deletions
diff --git a/sx-question-mode.el b/sx-question-mode.el
index 6d62e80..820c5b4 100644
--- a/sx-question-mode.el
+++ b/sx-question-mode.el
@@ -250,6 +250,7 @@ on the current buffer use
("v" sx-visit-externally)
("u" sx-upvote)
("d" sx-downvote)
+ ("O" sx-question-mode-order-by)
("q" quit-window)
(" " scroll-up-command)
("a" sx-answer)
@@ -292,6 +293,18 @@ query the api."
(unless (derived-mode-p 'sx-question-mode)
(error "Not in `sx-question-mode'")))
+(defun sx-question-mode-order-by (sort)
+ "Order answers in the current buffer by the method SORT.
+Sets `sx-question-list--order' and then calls
+`sx-question-list-refresh' with `redisplay'."
+ (interactive
+ (list (let ((order (sx-completing-read "Order answers by: "
+ (mapcar #'car sx-question-mode--sort-methods))))
+ (cdr-safe (assoc-string order sx-question-mode--sort-methods)))))
+ (when (and sort (functionp sort))
+ (setq sx-question-mode-answer-sort-function sort)
+ (sx-question-mode-refresh 'no-update)))
+
(provide 'sx-question-mode)
;;; sx-question-mode.el ends here