]> git.eshelyaron.com Git - emacs.git/commitdiff
Use display-buffer with re-builder (bug#49069)
authorpillule <pillule@riseup.net>
Thu, 8 Jul 2021 17:39:39 +0000 (20:39 +0300)
committerJuri Linkov <juri@linkov.net>
Thu, 8 Jul 2021 17:39:39 +0000 (20:39 +0300)
* 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

index 7d042a9102ee52808bef5b6dc050e6a4844c581a..396949d59a20208ab2c439e655ded0d31534b869 100644 (file)
@@ -355,11 +355,16 @@ provided in the Commentary section of this library."
       (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)))