From f463239252116d15cee9878c2952b9825152852f Mon Sep 17 00:00:00 2001 From: Trust me I am a doctor Date: Thu, 17 Jun 2021 05:56:34 +0200 Subject: [PATCH] Use display-buffer with re-builder * lisp/emacs-lisp/re-builder.el (re-builder): Uses 'display-buffer' with 'display-buffer-in-direction' to display the reb-buffer. This allow user-customizations and using it on not splitables windows. Add a dedication to its window so killing this buffer quit the window. --- lisp/emacs-lisp/re-builder.el | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/lisp/emacs-lisp/re-builder.el b/lisp/emacs-lisp/re-builder.el index 7d042a9102..396949d59a 100644 --- a/lisp/emacs-lisp/re-builder.el +++ b/lisp/emacs-lisp/re-builder.el @@ -355,11 +355,16 @@ re-builder (reb-delete-overlays)) (setq reb-target-buffer (current-buffer) reb-target-window (selected-window)) - (select-window (or (get-buffer-window reb-buffer) - (progn - (setq reb-window-config (current-window-configuration)) - (split-window (selected-window) (- (window-height) 4))))) - (switch-to-buffer (get-buffer-create reb-buffer)) + (select-window + (or (get-buffer-window reb-buffer) + (let ((dir (if (window-parameter nil 'window-side) + 'bottom 'down))) + (setq reb-window-config (current-window-configuration)) + (display-buffer + (get-buffer-create reb-buffer) + `((display-buffer-in-direction) + (direction . ,dir) + (dedicated . t)))))) (font-lock-mode 1) (reb-initialize-buffer))) -- 2.20.1