all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Philip Kaludercic <philipk@posteo.net>
To: Ergus <spacibba@aol.com>
Cc: help-gnu-emacs@gnu.org
Subject: Re: Help with display-buffer-alist
Date: Fri, 15 Apr 2022 14:33:18 +0000	[thread overview]
Message-ID: <87ilrabemp.fsf@posteo.net> (raw)
In-Reply-To: <20220415111531.ktoqlbfuusufjjdv@Ergus> (Ergus's message of "Fri,  15 Apr 2022 13:15:31 +0200")

Ergus <spacibba@aol.com> 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



  parent reply	other threads:[~2022-04-15 14:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20220415111531.ktoqlbfuusufjjdv.ref@Ergus>
2022-04-15 11:15 ` Help with display-buffer-alist Ergus
2022-04-15 11:47   ` Eric S Fraga
2022-04-15 14:33   ` Philip Kaludercic [this message]
2022-04-21  6:36     ` Juri Linkov
2022-04-21  7:26       ` Philip Kaludercic

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

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

  git send-email \
    --in-reply-to=87ilrabemp.fsf@posteo.net \
    --to=philipk@posteo.net \
    --cc=help-gnu-emacs@gnu.org \
    --cc=spacibba@aol.com \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.