ui/popup: fix quit-window sometimes breaking popups

By burying the buffer and switching to a buffer that doesn't belong in a
popup.
This commit is contained in:
Henrik Lissner 2019-12-16 05:42:40 -05:00
parent 08fb9c544d
commit 207ce02a33
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -29,6 +29,18 @@
;; Don't try to resize popup windows
(advice-add #'balance-windows :around #'+popup-save-a)
(defun +popup/quit-window ()
"The regular `quit-window' sometimes kills the popup buffer and switches to a
buffer that shouldn't be in a popup. We prevent that by remapping `quit-window'
to this commmand."
(interactive)
(let ((orig-buffer (current-buffer)))
(quit-window)
(when (and (eq orig-buffer (current-buffer))
(+popup-window-p))
(+popup/close))))
(global-set-key [remap quit-window] #'+popup/quit-window)
;;
;;; External functions