From e0a057c16b5fcd9ef48159520501b5d5e438c4a9 Mon Sep 17 00:00:00 2001 From: Juanma Barranquero Date: Wed, 7 Dec 2022 02:27:06 +0100 Subject: [PATCH] * lisp/bs.el: Improve compatibility with previous version * lisp/bs.el (bs-default-action-list): Remove display-buffer-reuse-window. Ask for a minimum height window, not maximum. (bs-show-in-buffer): Create window here, and afterwards make sure it's the only window showing the *bs-selection* buffer. (bs--show-with-configuration): Move window creation to bs-show-in-buffer. --- lisp/bs.el | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/lisp/bs.el b/lisp/bs.el index f880f3973a3..d7eed8f661d 100644 --- a/lisp/bs.el +++ b/lisp/bs.el @@ -488,9 +488,8 @@ Used internally, only.") "" #'bs-mouse-select "" #'bs-mouse-select-other-frame) -(defcustom bs-default-action-list '((display-buffer-reuse-window - display-buffer-below-selected) - (window-height . bs-max-window-height)) +(defcustom bs-default-action-list '((display-buffer-below-selected) + (window-height . window-min-height)) "Default action list for showing the '*bs-selection*' buffer. This list will be passed to `pop-to-buffer' as its ACTION argument. @@ -1170,7 +1169,18 @@ Select buffer *buffer-selection* and display buffers according to current configuration `bs-current-configuration'. Set window height, fontify buffer and move point to current buffer." (setq bs-current-list list) - (switch-to-buffer (get-buffer-create "*buffer-selection*")) + (let* ((window-combination-limit 'window-size) + (bs-buf (get-buffer-create "*buffer-selection*")) + (bs-win (progn + (pop-to-buffer bs-buf bs-default-action-list) + (selected-window)))) + ;; Delete other windows showing *buffer-selection*. + ;; Done after pop-to-buffer, instead of just calling delete-windows-on, + ;; to allow display-buffer-reuse(-mode)?-window to be used in ALIST. + (dolist (w (get-buffer-window-list bs-buf 'not t)) + (unless (eq w bs-win) + (with-demoted-errors "Error deleting window: %S" + (delete-window w))))) (bs-mode) (let* ((inhibit-read-only t) (map-fun (lambda (entry) @@ -1442,9 +1452,6 @@ for buffer selection." ;; Only when not in buffer *buffer-selection* ;; we have to set the buffer we started the command (setq bs--buffer-coming-from (current-buffer))) - (let ((window-combination-limit 'window-size)) - (pop-to-buffer (get-buffer-create "*buffer-selection*") - bs-default-action-list)) (bs-show-in-buffer (bs-buffer-list)) (bs-message-without-log "%s" (bs--current-config-message)))) -- 2.39.2