From a201a9ca279701a442f7a04f7111be419e13fdaa Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Thu, 6 Nov 2014 13:46:42 +0000 Subject: Handle small windows more gracefully. --- stack-question-list.el | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'stack-question-list.el') diff --git a/stack-question-list.el b/stack-question-list.el index 8b52aca..d658b17 100644 --- a/stack-question-list.el +++ b/stack-question-list.el @@ -261,10 +261,20 @@ focus the relevant window." (stack-question--mark-read data)) (unless (window-live-p stack-question--window) (setq stack-question--window - (split-window-below stack-question-list-height))) + (condition-case er + (split-window-below stack-question-list-height) + (error + ;; If the window is too small to split, use current one. + (if (string-match + "Window # too small for splitting" + (car (cdr-safe er))) + nil + (error (cdr er))))))) (stack-question--display data stack-question--window) (when focus - (select-window stack-question--window))) + (if stack-question--window + (select-window stack-question--window) + (switch-to-buffer stack-question--buffer)))) (defvar stack-question-list--buffer nil "Buffer where the list of questions is displayed.") -- cgit v1.2.3