From 6a5cd2255b409b956a2582e062b39131639a9564 Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Thu, 13 Nov 2014 16:07:55 +0000 Subject: Fix window managing --- sx-question-list.el | 3 ++- sx-question-mode.el | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/sx-question-list.el b/sx-question-list.el index ef5d3f5..8c558e6 100644 --- a/sx-question-list.el +++ b/sx-question-list.el @@ -279,7 +279,8 @@ focus the relevant window." (when (sx-question--read-p data) (cl-decf sx-question-list--unread-count) (sx-question--mark-read data)) - (unless (window-live-p sx-question-mode--window) + (unless (and (window-live-p sx-question-mode--window) + (null (equal sx-question-mode--window (selected-window)))) (setq sx-question-mode--window (condition-case er (split-window-below sx-question-list-height) diff --git a/sx-question-mode.el b/sx-question-mode.el index 199e082..686d357 100644 --- a/sx-question-mode.el +++ b/sx-question-mode.el @@ -184,7 +184,8 @@ QUESTION must be a data structure returned by `json-read'." (sx-assoc-let question (mapc #'sx-question-mode--print-section .answers)) (goto-char (point-min)) - (sx-question-mode-next-section)) + (with-selected-window sx-question-mode--window + (sx-question-mode-next-section))) (defun sx-question-mode--print-section (data) "Print a section corresponding to DATA. -- cgit v1.2.3