From: Stefan Monnier <monnier@iro.umontreal.ca>
To: help-gnu-emacs@gnu.org
Subject: Re: display-buffer-alist actions
Date: Wed, 24 Feb 2021 16:15:36 -0500 [thread overview]
Message-ID: <jwvpn0pjhwi.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: 87sg5lgy2z.fsf@ucl.ac.uk
> #+begin_src emacs-lisp
> (setq display-buffer-alist
> '(("^\\*Async Shell Command*" . (display-buffer-no-window))
> ("some regexp that works fine"
> (display-buffer-in-side-window)
> (window-width . 0.28)
> (side . left)
> (slot . 0))))
> #+end_src
>
> I have two monitors, one in landscape for which the above is ideal,
> although I do not quite understand it. I got it from somewhere on the
> Interweb...
IIRC (my memory is fuzzy, and I'm only to blame for the design of
this monster ;-) you can do:
(setq display-buffer-alist
'(("^\\*Async Shell Command*" . (display-buffer-no-window))
("some regexp that works fine"
my-tall-display-buffer-in-side-window
(window-width . <something>)
(side . bottom)
(slot . 0))
("some regexp that works fine"
display-buffer-in-side-window
(window-width . 0.28)
(side . left)
(slot . 0))))
(defun my-tall-display-buffer-in-side-window (&rest args)
(when (my-current-monitor-is-tall)
(apply #'display-buffer-in-side-window args)))
So the middle entry is only used when `my-current-monitor-is-tall`
returns non-nil.
An alternative would be something like:
(setq display-buffer-alist
'(("^\\*Async Shell Command*" . (display-buffer-no-window))
("some regexp that works fine"
my-display-buffer-in-side-window
(if-tall ((window-width . <something>)
(side . bottom))
((window-width . 0.28)
(side . left)))
(slot . 0))))
(defun my-display-buffer-in-side-window (buf alist)
(display-buffer-in-side-window
buf (append (nth (if (my-current-monitor-is-tall) 1 2)
(assq 'if-tall alist))
alist)))
-- Stefan
next prev parent reply other threads:[~2021-02-24 21:15 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-24 17:44 display-buffer-alist actions Eric S Fraga
2021-02-24 19:52 ` Joost Kremers
2021-02-24 20:08 ` Joost Kremers
2021-02-24 21:08 ` TRS-80
2021-02-24 20:57 ` Michael Heerdegen
2021-02-25 16:25 ` Eric S Fraga
2021-02-25 20:40 ` Garjola Dindi
2021-02-24 21:15 ` Stefan Monnier [this message]
2021-02-25 16:34 ` Eric S Fraga
2021-02-25 16:51 ` Stefan Monnier
2021-02-26 9:43 ` Eric S Fraga
2021-02-25 0:00 ` [External] : " Drew Adams
2021-02-25 4:28 ` Michael Heerdegen
2021-02-25 7:00 ` Drew Adams
2021-02-25 14:26 ` Stefan Monnier
2021-02-25 16:22 ` Drew Adams
2021-02-25 16:36 ` Eric S Fraga
2021-02-25 16:27 ` Eric S Fraga
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=jwvpn0pjhwi.fsf-monnier+emacs@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=help-gnu-emacs@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.
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).