New macro: save-popups!
This commit is contained in:
parent
5aeb5232ed
commit
6de185409f
2 changed files with 19 additions and 12 deletions
|
@ -196,6 +196,24 @@ window parameter."
|
|||
,@body
|
||||
(setq shackle-rules old-shackle-rules)))
|
||||
|
||||
;;;###autoload
|
||||
(defmacro save-popups! (&rest body)
|
||||
"Sets aside all popups before executing the original function, usually to
|
||||
prevent the popup(s) from messing up the UI (or vice versa)."
|
||||
`(let ((in-popup-p (doom-popup-p))
|
||||
(popups (doom-popup-windows))
|
||||
(doom-popup-remember-history t)
|
||||
(doom-popup-inhibit-autokill t))
|
||||
(when popups
|
||||
(mapc #'doom/popup-close popups))
|
||||
(unwind-protect
|
||||
(progn ,@body)
|
||||
(when popups
|
||||
(let ((origin (selected-window)))
|
||||
(doom/popup-restore)
|
||||
(unless in-popup-p
|
||||
(select-window origin)))))))
|
||||
|
||||
;;;###autoload
|
||||
(defun doom/other-popup (count)
|
||||
"Cycle through popup windows. Like `other-window', but for popups."
|
||||
|
|
|
@ -237,18 +237,7 @@ and setting `doom-popup-rules' within it. Returns the window."
|
|||
(defun doom*popups-save (orig-fn &rest args)
|
||||
"Sets aside all popups before executing the original function, usually to
|
||||
prevent the popup(s) from messing up the UI (or vice versa)."
|
||||
(let ((in-popup-p (doom-popup-p))
|
||||
(popups (doom-popup-windows))
|
||||
(doom-popup-remember-history t)
|
||||
(doom-popup-inhibit-autokill t))
|
||||
(when popups
|
||||
(mapc #'doom/popup-close popups))
|
||||
(unwind-protect (apply orig-fn args)
|
||||
(when popups
|
||||
(let ((origin (selected-window)))
|
||||
(doom/popup-restore)
|
||||
(unless in-popup-p
|
||||
(select-window origin)))))))
|
||||
(save-popups! (apply orig-fn args)))
|
||||
|
||||
(defun doom*delete-popup-window (&optional window)
|
||||
"Ensure that popups are deleted properly, and killed if they have :autokill
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue