From 298f7c2943fc7edbc146f2fee317f469a372b84a Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Sun, 19 Apr 2015 13:53:41 +0100 Subject: Hitting p only refreshes up to once per second. Fixes #278 --- sx-question-list.el | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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) -- cgit v1.2.3