From 02145bb456a667a399bf086b7214fcca16f933c6 Mon Sep 17 00:00:00 2001 From: Yann Herklotz Date: Mon, 24 Apr 2023 19:03:15 +0100 Subject: Check the number of open frames for Coq window creation --- ymh-emacs/ymh-common.el | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/ymh-emacs/ymh-common.el b/ymh-emacs/ymh-common.el index 09ebe08..8f36973 100644 --- a/ymh-emacs/ymh-common.el +++ b/ymh-emacs/ymh-common.el @@ -17,13 +17,25 @@ (defun ymh/reset-coq-windows () "Resets the Goal and Response windows." (interactive) - (other-frame 1) - (delete-other-windows) - (split-window-below) - (switch-to-buffer "*goals*") - (other-window 1) - (switch-to-buffer "*response*") - (other-frame 1)) + (let ((frame-n (length (frame-list)))) + (cond + ((eq frame-n 2) + (other-frame 1) + (delete-other-windows) + (split-window-below) + (switch-to-buffer "*goals*") + (other-window 1) + (switch-to-buffer "*response*") + (other-frame 1)) + (t + (delete-other-windows) + (split-window-right) + (other-window 1) + (switch-to-buffer "*goals*") + (split-window-below) + (other-window 1) + (switch-to-buffer "*response*") + (other-window 1))))) (defun ymh/pass (query) "Return the password as a string from QUERY." -- cgit