~protesilaos/emacs-notepad

be727aca1d98524f08a15d53dd4f4eb1e7c06303 — Protesilaos Stavrou 6 months ago edf9e22
Add section "General window and buffer tweaks"
1 files changed, 23 insertions(+), 0 deletions(-)

M emacs-notepad.org
M emacs-notepad.org => emacs-notepad.org +23 -0
@@ 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