The good side-window side
I want the content I am working on to be the centre of attention on my screen. I want as little scrolling as possible and most of the content I work with is taller than it is wide (code and org documents). On wide screens, buffers with shells, for version control, REPLs, help, info etc should therefore be on the side of the screen where it does not steal space from the main content. Since I read left to right, I like such windows to pop up on the right side where they do not disturb the flow of my reading of the main content. Emacs has the concept of side-windows that is useful for taming buffers that would otherwise pop up other places.
I set the width of my side-windows to 80 since man pages expect that and it works well for help and shells as well. To be able to have a (wo)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. I have not included ansi-term in the buffer-list for side-windows since I use it only occasionally when I want more than one terminal, in which case I need to be able to manage its windows in the normal way. Usually, there is no need for a full terminal emulator, but I use Eshell a lot.
At home, my laptops and my external screen are 16:9 or 16:10 wide screens. At my desk at work, I have a 16:9 screen, a 16:10 screen and another 16:9 screen flipped 90 degrees to the portrait orientation. I usually use the tall screen for Emacs to minimise scrolling. Since the tall screen is slim (9:16), I would rather have side-windows in the bottom instead of overlapping the main window on the right side when I use that screen. Even with the side-windows at the bottom, the screen is a lot taller than the wide screens which is nice.
However, I spend most of my time at work not at my desk, but in two classrooms where I either use my laptop only with its built-in screen, duplicated to a large screen in front of the class or only with an external screen when sitting in the back (for ergonomics). And there are also meetings where I use the laptop's internal screen only. All of these screens are wider than they are tall, so I want my side-windows on the right again.
So I made a function that checks whether the height of the frame is larger than the width and if so, side-windows are put on the bottom of the screen where they belong on tall screens, but if the opposite is true, then they are put on the right where they make more sense on wide screens. I call this function when Emacs starts in my configuration to adapt the side-windows to the screen in use, but I also have a keybinding (C-z w) for it so after moving from a classroom or meeting to my desk or vise versa, I can get the side-windows where I want them without having to end my Emacs session. I often prepare a file at my desk that I am going to present in class with inter-present-mode or jot something in a file during class that I work on at my desk later, so it is useful to keep the session going.
Here is my function for deciding which side side-windows should be on:
(defun emo-side-window-side () "Evaluates which side side-windows should be on based on whether the frame is in portrait or landscape orientation." (interactive) (let* ((side-window-side (if (> (frame-outer-height) (frame-outer-width)) 'bottom 'right)) (disp-buf-alist `(("\\*\\(Python\\|ielm\\|compilation\\).*\\*" (display-buffer-reuse-window display-buffer-in-side-window) (side . ,side-window-side) (slot . -1) (post-command-select-window . t) (window-width . 80)) ("\\*\\(shell\\|.*eshell\\).*\\*" (display-buffer-reuse-window display-buffer-in-side-window) (side . ,side-window-side) (slot . 0) (post-command-select-window . t) (window-width . 80)) ("\\*\\(help\\|info\\|man\\|woman\\|Agenda Commands\\|Org Agenda\\|Occur\\|Buffer.\\|xref\\).*\\*" (display-buffer-reuse-window display-buffer-in-side-window) (side . ,side-window-side) (slot . 1) (post-command-select-window . t) (window-width . 80))))) (setq display-buffer-alist disp-buf-alist)))