From 73b380e1407bfc688204812bbf58f9872e57f8c5 Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Tue, 25 Nov 2014 02:45:48 +0000 Subject: sx can also updates question-mode buffer. --- sx-question-mode.el | 19 ++++++++++++------- sx.el | 2 ++ 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 "") 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) -- cgit v1.2.3