From c7cb481e1ba3947931d28a4585624ea35fe76721 Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Wed, 26 Nov 2014 00:04:08 +0000 Subject: Old recentering bug We sometimes get an error because we're recentering a window that's not selected. --- sx-question-mode.el | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'sx-question-mode.el') diff --git a/sx-question-mode.el b/sx-question-mode.el index 8ccc576..dda65ab 100644 --- a/sx-question-mode.el +++ b/sx-question-mode.el @@ -469,11 +469,12 @@ Prefix argument N moves N sections down or up." (unless (and (overlayp ov) (overlay-get ov 'invisible)) (cl-decf count))))) - (when sx-question-mode-recenter-line - (let ((ov (car-safe (sx-question-mode--section-overlays-at (line-end-position))))) - (when (and (overlayp ov) (> (overlay-end ov) (window-end))) - (recenter sx-question-mode-recenter-line)))) - (sx-message-help-echo)) + (when (equal (selected-window) (get-buffer-window)) + (when sx-question-mode-recenter-line + (let ((ov (car-safe (sx-question-mode--section-overlays-at (line-end-position))))) + (when (and (overlayp ov) (> (overlay-end ov) (window-end))) + (recenter sx-question-mode-recenter-line)))) + (sx-message-help-echo))) (defun sx-question-mode-previous-section (&optional n) "Move down to previous section (question or answer) of this buffer. -- cgit v1.2.3