unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: pillule <pillule@riseup.net>
To: pillule <pillule@riseup.net>
Cc: 49069@debbugs.gnu.org
Subject: bug#49069: 28.0.50; [PATCH] Use display-buffer for re-builder
Date: Thu, 17 Jun 2021 06:10:53 +0200	[thread overview]
Message-ID: <87a6npf7pr.fsf@riseup.net> (raw)
In-Reply-To: <87r1h1jnf2.fsf@riseup.net>

[-- Attachment #1: Type: text/plain, Size: 468 bytes --]


pillule <pillule@riseup.net> writes:

> Hi, I wished re-builder was in a dedicated window (otherwise killing its buffer let
> you with an unwanted buffer in a narrow window), so I wrote a patch about it.
> It also have the benefit to uses display-buffer and so, to allow user-customization.

This second one is more reliable when it comes to call re-builder from a side
window.
(the original version simply prevented that case since a side window is not
splittable)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Use display-buffer for re-builder --]
[-- Type: text/x-diff, Size: 1695 bytes --]

From a52953ef8ef146cd105ad6dee7882e0dc298512d Mon Sep 17 00:00:00 2001
From: Trust me I am a doctor <pillule@riseup.net>
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 windows usually not splitables.
Add a dedication to its window so killing this buffer actually quit
its window.
---
 lisp/emacs-lisp/re-builder.el | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/lisp/emacs-lisp/re-builder.el b/lisp/emacs-lisp/re-builder.el
index 7d042a9102..747f741091 100644
--- a/lisp/emacs-lisp/re-builder.el
+++ b/lisp/emacs-lisp/re-builder.el
@@ -355,11 +355,15 @@ 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)
+         (progn (setq reb-window-config (current-window-configuration))
+                (display-buffer
+                 (get-buffer-create reb-buffer)
+                 `((display-buffer-in-direction)
+                   (direction . ,(if (eq (window-dedicated-p nil) 'side)
+                                     'bottom 'down))
+                   (dedicated . t))))))
     (font-lock-mode 1)
     (reb-initialize-buffer)))
 
-- 
2.20.1


[-- Attachment #3: Type: text/plain, Size: 119 bytes --]


I also tested it against the atomic windows showcased in the manual
and it seems ok, but I am not familiar with them.

  reply	other threads:[~2021-06-17  4:10 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-17  1:16 bug#49069: 28.0.50; [PATCH] Use display-buffer for re-builder pillule
2021-06-17  4:10 ` pillule [this message]
2021-06-17 14:50   ` pillule
2021-06-29 15:51     ` Trust me I am a Doctor
2021-06-29 20:47       ` Juri Linkov
2021-06-29 21:50         ` Trust me I am a Doctor
2021-06-30 19:49           ` Juri Linkov
2021-07-08 15:18             ` Trust me I am a Doctor
2021-07-08 17:40               ` Juri Linkov
2021-07-08 21:12                 ` Trust me I am a Doctor
     [not found]                   ` <87bl7c5wgl.fsf@riseup.net>
     [not found]                     ` <7355eaf3-5ae2-46e7-80f5-d3d23ffff7d8@Spark>
2021-07-09  9:00                       ` bug#49069: Fwd: " Trust me I am a Doctor
2021-07-08 18:38               ` Constantine Vetoshev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87a6npf7pr.fsf@riseup.net \
    --to=pillule@riseup.net \
    --cc=49069@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).