Add doom-popup-inhibit-autokill variable

This commit is contained in:
Henrik Lissner 2017-09-24 20:44:17 +02:00
parent e6f892b115
commit 65d758ce8f
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
2 changed files with 11 additions and 3 deletions

View file

@ -93,7 +93,8 @@ Returns t if popups were restored, nil otherwise."
(select-window doom-popup-other-window) (select-window doom-popup-other-window)
(other-window 1))) (other-window 1)))
(if (doom-popup-windows) (if (doom-popup-windows)
(doom/popup-close-all t) (let ((doom-popup-inhibit-autokill t))
(doom/popup-close-all t))
(doom/popup-restore))) (doom/popup-restore)))
;;;###autoload ;;;###autoload

View file

@ -39,6 +39,11 @@
"A list of window parameters that are set (and cleared) when `doom-popup-mode "A list of window parameters that are set (and cleared) when `doom-popup-mode
is enabled/disabled.'") is enabled/disabled.'")
(defvar doom-popup-inhibit-autokill nil
"Don't set this directly. Let-bind it. When it is non-nil, no buffers will be
killed when their associated popup windows are closed, despite their :autokill
property.")
(def-setting! :popup (&rest rules) (def-setting! :popup (&rest rules)
"Prepend a new popup rule to `shackle-rules' (see for format details). "Prepend a new popup rule to `shackle-rules' (see for format details).
@ -230,7 +235,8 @@ and setting `doom-popup-rules' within it. Returns the window."
prevent the popup(s) from messing up the UI (or vice versa)." prevent the popup(s) from messing up the UI (or vice versa)."
(let ((in-popup-p (doom-popup-p)) (let ((in-popup-p (doom-popup-p))
(popups (doom-popup-windows)) (popups (doom-popup-windows))
(doom-popup-remember-history t)) (doom-popup-remember-history t)
(doom-popup-inhibit-autokill t))
(when popups (when popups
(mapc #'doom/popup-close popups)) (mapc #'doom/popup-close popups))
(unwind-protect (apply orig-fn args) (unwind-protect (apply orig-fn args)
@ -248,7 +254,8 @@ properties."
(setq doom-popup-windows (delq window doom-popup-windows)) (setq doom-popup-windows (delq window doom-popup-windows))
(when doom-popup-remember-history (when doom-popup-remember-history
(setq doom-popup-history (list (doom--popup-data window)))) (setq doom-popup-history (list (doom--popup-data window))))
(let ((autokill-p (plist-get doom-popup-rules :autokill))) (let ((autokill-p (and (not doom-popup-inhibit-autokill)
(plist-get doom-popup-rules :autokill))))
(with-selected-window window (with-selected-window window
(doom-popup-mode -1) (doom-popup-mode -1)
(when autokill-p (when autokill-p