[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master e0a057c16b5 1/2: * lisp/bs.el: Improve compatibility with previou
From: |
Juanma Barranquero |
Subject: |
master e0a057c16b5 1/2: * lisp/bs.el: Improve compatibility with previous version |
Date: |
Tue, 6 Dec 2022 20:37:43 -0500 (EST) |
branch: master
commit e0a057c16b5fcd9ef48159520501b5d5e438c4a9
Author: Juanma Barranquero <lekktu@gmail.com>
Commit: Juanma Barranquero <lekktu@gmail.com>
* 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.")
"<mouse-2>" #'bs-mouse-select
"<mouse-3>" #'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))))