Fix popup windows in Emacs
Whenever you use a function that pops up a window in Emacs, it can be annoying and distracting. The buffer often take over one of the windows you already have on screen and that you are actively working in. For example, when using Python mode, I often felt that it was a bit random where the Python Shell buffer would show up when invoked with C-c C-p. The same problem occurs with help buffers, shell mode, eshell, ansi-term, async-shell-command, man, woman, occur etc. It isn't actually random, but the rules governing in which window new buffers show up, in the variable display-buffer-alist is quite opaque to a new user, so it seems random.
I lived with this seeming randomness for a while, but it annoyed me. Then I came across a video by David Wilson of SystemCrafters that showed me how I could use the concept of a side-window to not have popup windows take over my other windows. I also looked at his Emacs configuration and stole some of his settings. It solved the annoyance of popup windows taking over my other windows. He places his side-window in the bottom third of the screen. It makes sense when you want to pop up a shell or terminal, write a few commands and then close it again which you often see David do on his videos.
I also watched a video by Protesilaos Stavrou about side-windows where he explained the concept of slots. It solves the problem you have when you have more than one side-window from a popup buffer open at the same time. Maybe you have a help buffer and shell mode for instance. Prot also uses the lower part of his screen for his side-windows.
Since almost every screen is wider than it is tall, I think a better placement for user interface elements and extra information is on the left or right, not the top or bottom of the screen. Most content, except a few videos and pictures, are higher than they are tall. I want the content I am working on to take up as much as possible of the screen real estate to avoid unnecessary scrolling. This is why I always turn on the sidebar and off the toolbars in LibreOffice Writer and detest the Ribbon interface in MS365's Word.
Back to Emacs. I had a look at the Emacs manual which showed me how to tweak the settings David Wilson and Prot had taught me to get what I want. I think buffers with shells, for version control, REPLs, help, info etc should pop up on the side of the screen and leave the main buffer(s) alone. I want the content I am working on to always be the centre of attention. Since I read left to right, I like such windows to pop up on the right side of the screen where they disturb the other window(s) the least. (If I read right to left, I would have had them pop up on the left.) I set the width to 80 since man pages expect that and it works well for help and shells as well. (On smaller screens like the 1366 x 768 screen on the ThinkPad X230, this feels a bit large, but on larger screens like my 1440p external screen at home, it takes up less than a third of the screen. I could have used a ratio like 0.33 to have the side-window always take up one third of the screen, but that would mean it would be wider than necessary on large screens and too small for the content of [wo]man buffers on small screens, so after trying that for a while, I went with a fixed width in columns instead.)
To be able to have a man page and a shell, an info node and a REPL, or a shell, REPL and help buffer at the same time, I use slots to divide up the side-window if more than one special buffer is open. Slot -1 ends up at the top if there are more than one special window. Slot 0 ends up in the middle and slot 1 ends up at the bottom. I have REPLs at the top, shells in the middle and documentation in the bottom. I seldom use both a woman buffer and a help buffer at the same time, but I might use for example the Python REPL, Shell mode to launch and test out a python program and an info manual with Python documentation (yes, it is available in info format) at the same time, so it is useful to use different slots. If there is one buffer, the whole side of the screen is used and if there are two, the side is split in two if they occupy different slots.
Here is the code from my Emacs config for this:
(setq display-buffer-alist '(("\\*\\(Python\\|ielm\\|compilation\\).*\\*" (display-buffer-reuse-window display-buffer-in-side-window) (side . right) (slot . -1) (post-command-select-window . t) (window-width . 80)) ("\\*\\(shell\\|.*eshell\\).*\\*" (display-buffer-reuse-window display-buffer-in-side-window) (side . right) (slot . 0) (post-command-select-window . t) (window-width . 80)) ("\\*\\(help\\|info\\|man\\|woman\\|.*Ibuffer*\\|Agenda Commands\\|Org Agenda\\|Occur\\|xref\\).*\\*" (display-buffer-reuse-window display-buffer-in-side-window) (side . right) (slot . 1) (post-command-select-window . t) (window-width . 80))))