From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: pillule Newsgroups: gmane.emacs.bugs Subject: bug#49069: 28.0.50; [PATCH] Use display-buffer for re-builder Date: Thu, 17 Jun 2021 16:50:07 +0200 Message-ID: <871r90fsoq.fsf@riseup.net> References: <87r1h1jnf2.fsf@riseup.net> <87a6npf7pr.fsf@riseup.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="18298"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 49069@debbugs.gnu.org To: pillule Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Jun 17 16:55:13 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lttQG-0004U8-MK for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 17 Jun 2021 16:55:12 +0200 Original-Received: from localhost ([::1]:45008 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lttQF-00023T-Ne for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 17 Jun 2021 10:55:11 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:56190) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lttQ6-00023L-8j for bug-gnu-emacs@gnu.org; Thu, 17 Jun 2021 10:55:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:43456) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lttQ6-0006gc-0f for bug-gnu-emacs@gnu.org; Thu, 17 Jun 2021 10:55:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lttQ5-00037d-KJ for bug-gnu-emacs@gnu.org; Thu, 17 Jun 2021 10:55:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: pillule Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 17 Jun 2021 14:55:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 49069 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-Cc: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.162394165611940 (code B ref -1); Thu, 17 Jun 2021 14:55:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 17 Jun 2021 14:54:16 +0000 Original-Received: from localhost ([127.0.0.1]:55002 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lttPM-00036W-4H for submit@debbugs.gnu.org; Thu, 17 Jun 2021 10:54:16 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:60518) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lttPI-00036M-K2 for submit@debbugs.gnu.org; Thu, 17 Jun 2021 10:54:15 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55968) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lttPI-0001r8-5s for bug-gnu-emacs@gnu.org; Thu, 17 Jun 2021 10:54:12 -0400 Original-Received: from mx1.riseup.net ([198.252.153.129]:53230) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lttPF-00069D-LW for bug-gnu-emacs@gnu.org; Thu, 17 Jun 2021 10:54:11 -0400 Original-Received: from fews1.riseup.net (fews1-pn.riseup.net [10.0.1.83]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client CN "*.riseup.net", Issuer "Sectigo RSA Domain Validation Secure Server CA" (not verified)) by mx1.riseup.net (Postfix) with ESMTPS id 4G5Q742PMhzDqr0 for ; Thu, 17 Jun 2021 07:54:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=riseup.net; s=squak; t=1623941648; bh=28puK9RPfRs1mtRGFcv5T3CGjSTpwmeUJyurfgzoFIg=; h=References:From:To:Cc:Subject:Date:In-reply-to:From; b=cWgQ9FSKBTLZTlPXk4eGCiaEVNO6Hnipl9VaxQ8mNKPm/L2qKq3NhKS+l9lB6eXC8 lmh5jeUssmcl3M417HlmBd4F54Xt1O90PGDVWfQDQ40Iac0li8XZoRVPxsjb7DxYzk HratwM/CRBihLDDXDS4A3w5Bqz4tEgrdsxjAsLSY= X-Riseup-User-ID: 438671A26CF901177385368363A2D30699CE2FB33871B433BB8F62D4371AE51A Original-Received: from [127.0.0.1] (localhost [127.0.0.1]) by fews1.riseup.net (Postfix) with ESMTPSA id 4G5Q730Jzrz5vgB; Thu, 17 Jun 2021 07:54:06 -0700 (PDT) In-reply-to: <87a6npf7pr.fsf@riseup.net> Received-SPF: pass client-ip=198.252.153.129; envelope-from=pillule@riseup.net; helo=mx1.riseup.net X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:208667 Archived-At: --=-=-= Content-Type: text/plain pillule writes: > pillule 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) > > I also tested it against the atomic windows showcased in the manual > and it seems ok, but I am not familiar with them. This one is a little bit more reliable (use window-parameter instead of window-dedicated-p) and cleaner I hope. --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0003-Use-display-buffer-with-re-builder.patch Content-Description: with window-parameter >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 --=-=-= Content-Type: text/plain -- --=-=-=--