From 95c86b944368015804f0bfd0002dc098578bda58 Mon Sep 17 00:00:00 2001 From: Pierre Courtieu Date: Fri, 13 Nov 2015 16:37:28 +0100 Subject: Experimenting less brutal frame deletion. Only in coq mode for now. There are still some strange frame deletion some times. --- generic/pg-assoc.el | 16 ++++++++-------- generic/pg-response.el | 5 +++-- 2 files changed, 11 insertions(+), 10 deletions(-) (limited to 'generic') diff --git a/generic/pg-assoc.el b/generic/pg-assoc.el index 7b983bbf..6a27cd29 100644 --- a/generic/pg-assoc.el +++ b/generic/pg-assoc.el @@ -40,15 +40,17 @@ Some may be dead/nil." ;;;###autoload -(defun proof-associated-windows () +(defun proof-associated-windows (&optional all-frames) "Return a list of the associated buffers windows. -Dead or nil buffers are not represented in the list." +Dead or nil buffers are not represented in the list. Optional +argument ALL-FRAMES has the same meaning than for +`get-buffer-window'." (let ((bufs (proof-associated-buffers)) buf wins) (while bufs (setq buf (car bufs)) - (if (and buf (get-buffer-window buf)) - (setq wins (cons (get-buffer-window buf) wins))) + (if (and buf (get-buffer-window-list buf nil all-frames)) + (setq wins (append (get-buffer-window-list buf nil all-frames) wins))) (setq bufs (cdr bufs))) wins)) @@ -60,11 +62,9 @@ Dead or nil buffers are not represented in the list." "Remove windows of LW not displaying at least one associated buffer." (remove-if-not (lambda (w) (proof-associated-buffer-p (window-buffer w))) lw)) -(defun proof-find-all-associated-windows () - "Return the list of windows displaying an associated buffer." - (proof-filter-associated-windows (window-list-1 nil nil t))) -(defun proof-find-all-associated-frames () +;;;###autoload +(defun proof-associated-frames () "Return the list of frames displaying at least one associated buffer." (remove-if-not (lambda (f) (proof-filter-associated-windows (window-list f))) (frame-list))) diff --git a/generic/pg-response.el b/generic/pg-response.el index e903858e..b0cf217d 100644 --- a/generic/pg-response.el +++ b/generic/pg-response.el @@ -188,7 +188,8 @@ Following POLICY, which can be one of 'smart, 'horizontal, proof-script-buffer proof-goals-buffer proof-response-buffer policy)))) - +;; this is a canidate for replacing proof-delete-other-frames below, less brutal. +;; For the moment we experiment this locall on coq mode. (defun proof-delete-all-associated-windows () "Delete windows (and maybe frames) showing associated buffers. Delete a frame if it displays only associated buffers, unless it @@ -198,7 +199,7 @@ is the only frame (try to bury buffers then)." (if (not (frame-root-window-p w)) (delete-window w) (if (< 1 (length (frame-list))) (delete-frame (window-frame w)) (window--display-buffer (other-buffer) w 'window)))) - (proof-find-all-associated-windows))) + (proof-associated-windows t))) (defvar pg-frame-configuration nil "Variable storing last used frame configuration.") -- cgit v1.2.3