Tweak setting `display-buffer-alist'

This commit is contained in:
Gerard Vermeulen 2024-05-05 08:52:02 +02:00
parent 6b90fab03d
commit 416f2435db

View File

@ -622,6 +622,10 @@ verse and quote blocks are fontified using the `org-verse' and
Mickey Peterson's post [[https://www.masteringemacs.org/article/demystifying-emacs-window-manager][Demystifying Emacs's Window Manager]] invites to improve Mickey Peterson's post [[https://www.masteringemacs.org/article/demystifying-emacs-window-manager][Demystifying Emacs's Window Manager]] invites to improve
window placement. Listing [[lst:1st-window-management]], [[lst:2nd-window-management]] window placement. Listing [[lst:1st-window-management]], [[lst:2nd-window-management]]
and [[lst:3rd-window-management]] implement a selection of his recommendations. and [[lst:3rd-window-management]] implement a selection of his recommendations.
See:
1. [[info:elisp#The Zen of Buffer Display][The Zen of Buffer Display (info)]]
2. [[https://e17i.github.io/articles-emacs-display-1/][Configuring the Emacs display system]]
for technical information.
#+caption[Window management functions and key bindings]: #+caption[Window management functions and key bindings]:
#+caption: Window management functions and key bindings. #+caption: Window management functions and key bindings.
@ -670,24 +674,23 @@ and [[lst:3rd-window-management]] implement a selection of his recommendations.
#+caption[Window management variables]: #+caption[Window management variables]:
#+caption: Window management variables. #+caption: Window management variables.
#+name: lst:3rd-window-management #+name: lst:3rd-window-management
#+begin_src emacs-lisp -n #+begin_src emacs-lisp -n :results none
(with-eval-after-load 'emacs (with-eval-after-load 'emacs
;; https://www.masteringemacs.org/article/demystifying-emacs-window-manager ;; https://www.masteringemacs.org/article/demystifying-emacs-window-manager
;; GAV: `display-buffer-alist' fails to set the *Warnings* buffer position.
(setopt switch-to-buffer-obey-display-actions t)
(add-to-list 'display-buffer-alist (add-to-list 'display-buffer-alist
`(,(rx (or "*Apropos*" `(,(rx (or "*Apropos*" "*Dictionary*" "*Help*" "*info"))
"*Dictionary*"
"*Help*"
"*info"))
(display-buffer-reuse-window display-buffer-pop-up-window) (display-buffer-reuse-window display-buffer-pop-up-window)
(inhibit-same-window . nil))) (inhibit-same-window . nil)))
(add-to-list 'display-buffer-alist (add-to-list 'display-buffer-alist
`(,(rx (or "*Occur*" `(,(rx (or "*Occur*" "*grep*" "*xref*"))
"*grep*"
"*xref*"))
display-buffer-reuse-window display-buffer-reuse-window
(inhibit-same-window . nil))) (inhibit-same-window . nil)))
;; Handling the *Warnings* buffer like the *compilation* buffer also fails.
;; BUG#70773: Eli tells `(setq delayed-warnings-hook nil)' is better.
(add-to-list 'display-buffer-alist (add-to-list 'display-buffer-alist
'("\\*compilation\\*" `(,(rx (or "*compilation*"))
display-buffer-no-window display-buffer-no-window
(allow-no-window . t)))) (allow-no-window . t))))
#+end_src #+end_src