From 29bc91bca5cd7e25fdc8ecd772f9346341bc41b4 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Fri, 13 Feb 2026 01:33:44 -0500 Subject: [PATCH] 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 --- modules/ui/popup/+hacks.el | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/modules/ui/popup/+hacks.el b/modules/ui/popup/+hacks.el index 05dd44983..b5b84ec0b 100644 --- a/modules/ui/popup/+hacks.el +++ b/modules/ui/popup/+hacks.el @@ -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) ;;