diff options
author | Artur Malabarba <bruce.connor.am@gmail.com> | 2015-02-26 22:26:42 -0300 |
---|---|---|
committer | Artur Malabarba <bruce.connor.am@gmail.com> | 2015-02-26 22:26:42 -0300 |
commit | a603180449f9d17f5f7230638f43e3b2c6ecc363 (patch) | |
tree | 5f921eded79a1b1a068a1558d355ca9c9fe783a2 /sx-question-mode.el | |
parent | d8968604c6d2e11e5365031759069fb5a671f688 (diff) | |
parent | ee4e74f25fdb97faf4cb92952072a42b7b507e2a (diff) |
Merge branch 'generate-header-line-from-keymap' into delete-command
Diffstat (limited to 'sx-question-mode.el')
-rw-r--r-- | sx-question-mode.el | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/sx-question-mode.el b/sx-question-mode.el index fd7f026..c91d13e 100644 --- a/sx-question-mode.el +++ b/sx-question-mode.el @@ -174,13 +174,14 @@ property." ("d" sx-downvote "downvote") ("q" quit-window) ("SPC" scroll-up-command) - ("c" sx-comment "comment") - ("a" sx-answer "answer") ("e" sx-edit "edit") ("S" sx-search) ("*" sx-favorite "star") ("K" sx-delete "Delete") ("s" sx-switchto-map "switch-to") + ("O" sx-question-mode-order-by "Order") + ("c" sx-comment "comment") + ("a" sx-answer "answer") ("TAB" forward-button "Navigate") ("<S-iso-lefttab>" backward-button) ("<S-tab>" backward-button) @@ -247,6 +248,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 |