aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArtur Malabarba <bruce.connor.am@gmail.com>2014-11-25 02:45:48 +0000
committerArtur Malabarba <bruce.connor.am@gmail.com>2014-11-25 02:45:48 +0000
commit73b380e1407bfc688204812bbf58f9872e57f8c5 (patch)
treef5b1b0a1a73f2fdff9ff502edb091e5e5cfc1b53
parentb5bcd91bffb67ee1a902a15f2857784626435852 (diff)
sx can also updates question-mode buffer.
-rw-r--r--sx-question-mode.el19
-rw-r--r--sx.el2
2 files changed, 14 insertions, 7 deletions
diff --git a/sx-question-mode.el b/sx-question-mode.el
index 59313d1..416a4eb 100644
--- a/sx-question-mode.el
+++ b/sx-question-mode.el
@@ -552,16 +552,21 @@ Letters do not insert themselves; instead, they are commands.
(,(kbd "<backtab>") backward-button)
([return] push-button)))
-(defun sx-question-mode-refresh ()
+(defun sx-question-mode-refresh (&optional no-update)
"Refresh currently displayed question.
Queries the API for any changes to the question or its answers or
-comments, and redisplays it."
- (interactive)
+comments, and redisplays it.
+
+With non-nil prefix argument NO-UPDATE, just redisplay, don't
+query the api."
+ (interactive "P")
(sx-question-mode--ensure-mode)
- (sx-assoc-let sx-question-mode--data
- (sx-question-mode--display
- (sx-question-get-question .site .question_id)
- (selected-window))))
+ (sx-question-mode--display
+ (if no-update
+ sx-question-mode--data
+ (sx-assoc-let sx-question-mode--data
+ (sx-question-get-question .site .question_id)))
+ (selected-window)))
(defun sx-question-mode--ensure-mode ()
"Ensures we are in question mode, erroring otherwise."
diff --git a/sx.el b/sx.el
index 09b5181..5fbfbb8 100644
--- a/sx.el
+++ b/sx.el
@@ -199,6 +199,8 @@ Return the result of BODY."
"Refresh the question list if we're inside it."
(cond
((derived-mode-p 'sx-question-list-mode)
+ (sx-question-list-refresh 'redisplay 'no-update))
+ ((derived-mode-p 'sx-question-mode)
(sx-question-list-refresh 'redisplay 'no-update))))
(defun sx--copy-data (from to)