(Emacs)+use-package keyword adding records to display-buffer-alist

Pretty nice task, integrates into use-package really well.
This commit is contained in:
2020-10-01 01:49:29 +01:00
parent 2115335ac7
commit 65dfb6006b

View File

@@ -678,13 +678,13 @@ later.
** Window management ** Window management
Window management is really important. I find the default window Window management is really important. I find the default window
handling of Emacs incredibly annoying: sometimes consuming my windows, handling of Emacs incredibly annoying: sometimes consuming my windows,
sometimes creating new ones. So, as Emacs is the ultimate editor, I sometimes creating new ones. Of course, as Emacs is a powerful lisp
want to configure and fine tune the window management of Emacs. interpreter, this is easily manageable.
As I am a man who requires only the highest of optimisations, I always Here I create a few use-package extensions that manages the whole
am looking for ways to make my system faster. The buffer management ordeal of adding a new record to the display-buffer-alist, a useful
commands are defined in the window library, so I bind them in general abstraction that makes it easy to manage the various buffers created
here as well via a wrapping use-package declaration. by packages.
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package window (use-package window
:straight nil :straight nil
@@ -696,59 +696,50 @@ here as well via a wrapping use-package declaration.
"j" #'next-buffer "j" #'next-buffer
"k" #'previous-buffer) "k" #'previous-buffer)
:init :init
(setq (with-eval-after-load "use-package-core"
display-buffer-alist (add-to-list 'use-package-keywords ':display)
'(("\\*Org Src.*" (defun use-package-normalize/:display (_name-symbol _keyword args)
(display-buffer-same-window)) args)
("\\*e?shell\\*"
(display-buffer-at-bottom) (defun use-package-handler/:display (name _keyword args rest state)
(window-height . 0.25)) (use-package-concat
("\\*[Hh]elp.*" (use-package-process-keywords name rest state)
(display-buffer-at-bottom) (let ((arg args)
(inhibit-duplicate-buffer . t) forms)
(window-height . 0.25)) (while arg
("\\*\\(Wo\\)?Man.*" (add-to-list 'forms
(display-buffer-at-bottom) `(add-to-list 'display-buffer-alist
(window-height . 0.25)) ',(car arg)))
("\\*Proced\\*" (setq arg (cdr arg)))
(display-buffer-at-bottom) forms)))))
(window-height . 0.25)) #+end_src
("\\*Process List\\*" *** Setup default display records
(display-buffer-at-bottom) Using the =:display= keyword, setup up some =display-buffer-alist=
(window-height . 0.25)) records.
("magit:.*" #+begin_src emacs-lisp
(display-buffer-same-window) (use-package window
(inhibit-duplicate-buffer . t)) :straight nil
("magit-diff:.*" :display
(display-buffer-below-selected)) ("\\*\\(Wo\\)?Man.*"
("magit-log:.*" (display-buffer-at-bottom)
(display-buffer-same-window)) (window-height . 0.25))
("\\*compilation\\*"
(display-buffer-at-bottom) ("\\*Process List\\*"
(window-height . 0.25)) (display-buffer-at-bottom)
("\\*\\(Ido \\)?Completions\\*" (window-height . 0.25))
(display-buffer-in-side-window)
(window-height . 0.25) ("\\*compilation\\*"
(side . bottom)) (display-buffer-at-bottom)
("\\*Flycheck.*" (window-height . 0.25))
(display-buffer-at-bottom)
(window-height . 0.25)) ("\\*\\(Ido \\)?Completions\\*"
("grep\\*" (display-buffer-in-side-window)
(display-buffer-at-bottom) (window-height . 0.25)
(window-height . 0.25)) (side . bottom))
("\\*Python\\*"
(display-buffer-at-bottom) ("\\*Async Shell Command\\*"
(window-height . 0.25)) (display-buffer-at-bottom)
("\\*Org Export.*" (window-height . 0.25)))
(display-buffer-at-bottom)
(window-height . 0.25))
("\\*Async Shell Command\\*"
(display-buffer-at-bottom)
(window-height . 0.25))
("\\*haskell\\*"
(display-buffer-at-bottom)
(window-height . 0.25))
)))
#+end_src #+end_src
** Auto typing ** Auto typing
*** Auto typing Preamble *** Auto typing Preamble