@@ 1247,6 1247,29 @@ to split windows in a way that is easy to use.
(window-height . fit-window-to-buffer))))
#+end_src
+* General window and buffer tweaks
+
+In this section we make use of the ~display-buffer-alist~ to control
+the display and placement of buffers in windows. Each section covers
+the details.
+
+** Focus ~occur~ buffer when it is displayed
+
+Here we are leveraging the powerful ~display-buffer-alist~ to write
+rules for what should happen with buffers that are either using (or
+derived-from) the ~occur-mode~ OR are named =*Occur...=. The buffer
+is displayed below the current window, thus remaining close to its
+context, while it automatically gets focus.
+
+#+begin_src emacs-lisp
+(add-to-list 'display-buffer-alist
+ '((or . ((derived-mode . occur-mode)
+ "\\*Occur.*"))
+ (display-buffer-reuse-mode-window display-buffer-below-selected)
+ (window-height . fit-window-to-buffer)
+ (body-function . (lambda (buffer) (select-window buffer)))))
+#+end_src
+
* Load the =emacs-notepad= modules
We define some modules for our Emacs configuration and load them