aboutsummaryrefslogtreecommitdiff
path: root/sx-question-mode.el
diff options
context:
space:
mode:
Diffstat (limited to 'sx-question-mode.el')
-rw-r--r--sx-question-mode.el16
1 files changed, 14 insertions, 2 deletions
diff --git a/sx-question-mode.el b/sx-question-mode.el
index fdb6487..9653485 100644
--- a/sx-question-mode.el
+++ b/sx-question-mode.el
@@ -545,6 +545,7 @@ Letters do not insert themselves; instead, they are commands.
`(("n" sx-question-mode-next-section)
("p" sx-question-mode-previous-section)
("g" sx-question-mode-refresh)
+ ("v" sx-question-mode-visit)
("q" quit-window)
(" " scroll-up-command)
(,(kbd "S-SPC") scroll-down-command)
@@ -555,18 +556,29 @@ Letters do not insert themselves; instead, they are commands.
(,(kbd "<backtab>") backward-button)
([return] push-button)))
+(defun sx-question-mode-visit ()
+ "Visit the currently displayed question."
+ (interactive)
+ (sx-question-mode--ensure-mode)
+ (sx-assoc-let sx-question-mode--data
+ (browse-url .link)))
+
(defun sx-question-mode-refresh ()
"Refresh currently displayed question.
Queries the API for any changes to the question or its answers or
comments, and redisplays it."
(interactive)
- (unless (derived-mode-p 'sx-question-mode)
- (error "Not in `sx-question-mode'"))
+ (sx-question-mode--ensure-mode)
(sx-assoc-let sx-question-mode--data
(sx-question-mode--display
(sx-question-get-question
sx-question-list--current-site .question_id)
(selected-window))))
+(defun sx-question-mode--ensure-mode ()
+ "Ensures we are in question mode, erroring otherwise."
+ (unless (derived-mode-p 'sx-question-mode)
+ (error "Not in `sx-question-mode'")))
+
(provide 'sx-question-mode)
;;; sx-question-mode.el ends here