From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Philip Kaludercic Newsgroups: gmane.emacs.help Subject: Re: Help with display-buffer-alist Date: Fri, 15 Apr 2022 14:33:18 +0000 Message-ID: <87ilrabemp.fsf@posteo.net> References: <20220415111531.ktoqlbfuusufjjdv.ref@Ergus> <20220415111531.ktoqlbfuusufjjdv@Ergus> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="22911"; mail-complaints-to="usenet@ciao.gmane.io" Cc: help-gnu-emacs@gnu.org To: Ergus Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Fri Apr 15 16:37:29 2022 Return-path: Envelope-to: geh-help-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 1nfN4j-0005kP-Db for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 15 Apr 2022 16:37:29 +0200 Original-Received: from localhost ([::1]:56686 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nfN4i-0005BF-7R for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 15 Apr 2022 10:37:28 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:39856) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nfN12-0005B5-PS for help-gnu-emacs@gnu.org; Fri, 15 Apr 2022 10:33:40 -0400 Original-Received: from mout01.posteo.de ([185.67.36.65]:39371) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nfN0v-000318-EV for help-gnu-emacs@gnu.org; Fri, 15 Apr 2022 10:33:40 -0400 Original-Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id B472E240027 for ; Fri, 15 Apr 2022 16:33:19 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1650033199; bh=WS1WW+J1hptKFFeIh7umQ/qzjOCUy0r2U5xrP3/ECfI=; h=From:To:Cc:Subject:Autocrypt:Date:From; b=RMWEpyI/fxlhcMBe5TsO9pgvGAY196H5JZ3QPehqHCqNmGr1L2DNYeVaMlblV9It4 j0fmyZh+cmhIy+16NgR8WLXfA1X51yhutXCc0fQMlGIk1choJFIlqLdP2JC6dKlAoq K9R4BtzA+Q5mGFvB4EJCZ1ysTIDdYHIYjDE1bLcGPReK4inWnnbKgszzyOQpkfpCjS W6z5IyIfCYKlpTTfY0eQe8nq/dWL2OVxoUgZ7AQf66amea5rGYRRjTQd5EobeVVW3/ Miz0C5mVC7ooT1EETjwhjYrcc8H/0AgVUzQYaqP4oWlx3RaSIW5QnG/bVCvyzaakbn ByW62P8SWcp5g== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4KfzMf6V90z6tmS; Fri, 15 Apr 2022 16:33:18 +0200 (CEST) Autocrypt: addr=philipk@posteo.net; prefer-encrypt=nopreference; keydata= mDMEYHHqUhYJKwYBBAHaRw8BAQdAp3GdmYJ6tm5McweY6dEvIYIiry+Oz9rU4MH6NHWK0Ee0QlBo aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0 ZW8ubmV0PoiQBBMWCAA4FiEEDM2H44ZoPt9Ms0eHtVrAHPRh1FwFAmBx6lICGwMFCwkIBwIGFQoJ CAsCBBYCAwECHgECF4AACgkQtVrAHPRh1FyTkgEAjlbGPxFchvMbxzAES3r8QLuZgCxeAXunM9gh io0ePtUBALVhh9G6wIoZhl0gUCbQpoN/UJHI08Gm1qDob5zDxnIHuDgEYHHqUhIKKwYBBAGXVQEF AQEHQNcRB+MUimTMqoxxMMUERpOR+Q4b1KgncDZkhrO2ql1tAwEIB4h4BBgWCAAgFiEEDM2H44Zo Pt9Ms0eHtVrAHPRh1FwFAmBx6lICGwwACgkQtVrAHPRh1Fw1JwD/Qo7kvtib8jy7puyWrSv0MeTS g8qIxgoRWJE/KKdkCLEA/jb9b9/g8nnX+UcwHf/4VfKsjExlnND3FrBviXUW6NcB In-Reply-To: <20220415111531.ktoqlbfuusufjjdv@Ergus> (Ergus's message of "Fri, 15 Apr 2022 13:15:31 +0200") Received-SPF: pass client-ip=185.67.36.65; envelope-from=philipk@posteo.net; helo=mout01.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:136922 Archived-At: Ergus writes: > Hi: > > I am trying to mimic somehow the swiper behavior with occur. The first > step for that is to put the occur window always at bottom which was > pretty simple with this: > > (add-to-list 'display-buffer-alist ("*Occur*" display-buffer-at-bottom)) ^ watch out, this is a regular expression matching a buffer name, so the * has to be escaped [0]. > But now I want somehow to limit the window height to 10 lines. > > With the documentation of display-buffer and display-buffer-alist It > says that there should be (CONDITION . ACTION) where: > > ACTION is a cons cell (FUNCTIONS . ALIST), where FUNCTIONS is an > action function or a list of action functions and ALIST is an > action alist. Each such action function should accept two > arguments: a buffer to display and an alist of the same form as > ALIST. See `display-buffer' for details. > > > So I tried substituting display-buffer-at-bottom with: > > (display-buffer-at-bottom . (window-height . 10)) Note that (window-height . 10) is not an alist, but an element of an alist. The alist you want to pass is ((window-height . 10)) which means (FUNCTION . ALIST) is (display-buffer-at-bottom . ((window-height . 10))) or simply (display-buffer-at-bottom (window-height . 10)) making the `add-to-list' call (add-to-list 'display-buffer-alist '("*Occur*" display-buffer-at-bottom (window-height . 10))) Or alternatively if you are tracking the master brach (add-to-list 'display-buffer-alist '((major-mode occur-mode) display-buffer-at-bottom (window-height . 10))) which uses the new buffer-match-p system. > But I am obviously doing something wrong because this just doesn't > work... so the question is: how do I use correctly the > (FUNCTIONS . ALIST) in the extended way? > > Thanks in advance, > Ergus... > > PD: Maybe another example with this answer may be added to the docstring. > > -- Philip Kaludercic