Add new variable: doom-popup-windows

Contains a list of open popup windows.

This preserves window order. Before this commit, doom-popup-windows (the
function), did not do this.
This commit is contained in:
Henrik Lissner 2017-07-06 17:43:17 +02:00
parent 4fc39a0f71
commit 8c3693ed47
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
2 changed files with 6 additions and 1 deletions

View file

@ -47,7 +47,7 @@ possible rules."
;;;###autoload
(defun doom-popup-windows ()
"Get a list of open pop up windows."
(cl-remove-if-not #'doom-popup-p (window-list)))
(cl-remove-if-not #'doom-popup-p doom-popup-windows))
;;;###autoload
(defun doom/popup-restore ()

View file

@ -28,6 +28,9 @@
(defvar doom-popup-no-fringes t
"If non-nil, disable fringes in popup windows.")
(defvar doom-popup-windows ()
"A list of open popup windows.")
(defvar-local doom-popup-rules nil
"The shackle rule that caused this buffer to be recognized as a popup.")
@ -215,6 +218,7 @@ and setting `doom-popup-rules' within it. Returns the window."
(setcar args (clone-indirect-buffer (buffer-name (car args)) nil t)))
(unless (setq window (apply orig-fn args))
(error "No popup window was found for %s: %s" (car args) plist))
(cl-pushnew window doom-popup-windows :test #'eq)
(with-selected-window window
(unless (eq plist t)
(setq-local doom-popup-rules plist))
@ -241,6 +245,7 @@ prevent the popup(s) from messing up the UI (or vice versa)."
properties."
(let ((window (or window (selected-window))))
(when (doom-popup-p window)
(setq doom-popup-windows (delq window doom-popup-windows))
(when doom-popup-remember-history
(setq doom-popup-history (list (doom--popup-data window))))
(let ((autokill-p (plist-get doom-popup-rules :autokill)))