diff options
author | Artur Malabarba <bruce.connor.am@gmail.com> | 2014-12-01 02:02:14 +0000 |
---|---|---|
committer | Artur Malabarba <bruce.connor.am@gmail.com> | 2014-12-01 02:24:37 +0000 |
commit | 5bb980d36c6e0346da629ceeb1835a020e75a9b4 (patch) | |
tree | 88c05e4b7d76fbea065646fec16beaebda3cedc9 /sx-interaction.el | |
parent | 867224348a5d979af7a965c9bbe476dea3c3638f (diff) |
Refactor sx-question-list-display-question into 2 other functions
Diffstat (limited to 'sx-interaction.el')
-rw-r--r-- | sx-interaction.el | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/sx-interaction.el b/sx-interaction.el index 8f87a47..f34c49c 100644 --- a/sx-interaction.el +++ b/sx-interaction.el @@ -82,6 +82,30 @@ If DATA is a question, also mark it as read." (sx-question--mark-read data) (sx--maybe-update-display)))) + +;;; Displaying +(defun sx-display-question (&optional data focus window) + "Display question given by DATA, on WINDOW. +When DATA is nil, display question under point. When FOCUS is +non-nil (the default when called interactively), also focus the +relevant window. + +If WINDOW nil, the window is decided by +`sx-question-mode-display-buffer-function'." + (interactive (list (sx--data-here) t)) + (when (sx-question--mark-read data) + (sx--maybe-update-display)) + ;; Display the question. + (setq window + (get-buffer-window + (sx-question-mode--display data window))) + (when focus + (if (window-live-p window) + (select-window window) + (switch-to-buffer sx-question-mode--buffer)))) + + +;;; Voting (defun sx-toggle-upvote (data) "Apply or remove upvote from DATA. DATA can be a question, answer, or comment. Interactively, it is |