aboutsummaryrefslogtreecommitdiff
path: root/sx-question-mode.el
diff options
context:
space:
mode:
authorSean Allred <code@seanallred.com>2014-11-16 22:28:50 -0500
committerSean Allred <code@seanallred.com>2014-11-16 22:28:50 -0500
commit2e527f3e3c4802602c9f1cff659f0c36a39fce2f (patch)
tree8a2185625540da7504d42a9c671937400f27456f /sx-question-mode.el
parent35ed7285e9271da388ed23416a27d40fd90807e3 (diff)
Add function to browse-url in question-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