[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: display-buffer-alist actions
From: |
Stefan Monnier |
Subject: |
Re: display-buffer-alist actions |
Date: |
Wed, 24 Feb 2021 16:15:36 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
> #+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
Re: [External] : display-buffer-alist actions, Eric S Fraga, 2021/02/25