fix(popup): remap quit-window to +popup/close

Ensures popups closed via `quit-window` are remembered (for later
restoration, if possible).

Fix: #8650
Close: #8653
This commit is contained in:
Henrik Lissner 2026-02-13 01:33:44 -05:00
parent b468dae066
commit 29bc91bca5
No known key found for this signature in database
GPG key ID: B60957CA074D39A3

View file

@ -38,17 +38,10 @@ grows larger."
;; Don't try to resize popup windows
(advice-add #'balance-windows :around #'+popup-save-a)
(defun +popup/quit-window (&optional arg)
"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 "P")
(let ((orig-buffer (current-buffer)))
(quit-window arg)
(when (and (eq orig-buffer (current-buffer))
(+popup-buffer-p))
(+popup/close nil 'force))))
(define-key +popup-buffer-mode-map [remap quit-window] #'+popup/quit-window)
;; The regular `quit-window' sometimes kills the popup buffer and switches to a
;; buffer that shouldn't be in a popup; this is prevented by remapping the
;; command in popups:
(define-key +popup-buffer-mode-map [remap quit-window] #'+popup/close)
;;