diff options
-rw-r--r-- | sx-question-mode.el | 19 | ||||
-rw-r--r-- | 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 "<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." @@ -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) |