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:
parent
08fb9c544d
commit
207ce02a33
1 changed files with 12 additions and 0 deletions
|
@ -29,6 +29,18 @@
|
||||||
;; Don't try to resize popup windows
|
;; Don't try to resize popup windows
|
||||||
(advice-add #'balance-windows :around #'+popup-save-a)
|
(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
|
;;; External functions
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue