aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArtur Malabarba <bruce.connor.am@gmail.com>2015-04-19 13:53:41 +0100
committerArtur Malabarba <bruce.connor.am@gmail.com>2015-04-19 13:53:41 +0100
commit298f7c2943fc7edbc146f2fee317f469a372b84a (patch)
tree95afdcf676a4c791f40f37b51b213fef3ae22e52
parent706530f8f96dec5725a46774d85fe98c6b54912a (diff)
Hitting p only refreshes up to once per second. Fixes #278
-rw-r--r--sx-question-list.el9
1 files changed, 8 insertions, 1 deletions
diff --git a/sx-question-list.el b/sx-question-list.el
index 8d06cd0..76fb730 100644
--- a/sx-question-list.el
+++ b/sx-question-list.el
@@ -532,12 +532,19 @@ high (if possible)."
`(window window ,(selected-window) ,sx-question-mode--buffer))
window)))
+(defvar sx-question-list--last-refresh (current-time)
+ "Time of the latest refresh.")
+
(defun sx-question-list-next (n)
"Move cursor down N questions.
This does not update `sx-question-mode--window'."
(interactive "p")
(if (and (< n 0) (bobp))
- (sx-question-list-refresh 'redisplay)
+ (when (> (time-to-seconds
+ (time-subtract (current-time) sx-question-list--last-refresh))
+ 1)
+ (sx-question-list-refresh 'redisplay)
+ (setq sx-question-list--last-refresh (current-time)))
(forward-line n)
;; If we were trying to move forward, but we hit the end.
(when (eobp)