Start to play with window placement

This commit is contained in:
Gerard Vermeulen 2022-09-01 03:54:05 +02:00
parent 532fbdbc7a
commit e094edfeef

View File

@ -491,6 +491,58 @@ show a few tweaks to improve visibility without theming:
"My face to show a here-document."))
#+end_src
* [[info:emacs#Windows][Window management (info)]]
:PROPERTIES:
:CUSTOM_ID: sec:window-management
:END:
Mickey Peterson's post [[https://www.masteringemacs.org/article/demystifying-emacs-window-manager][Demystifying Emacs's Window Manager]] invites to improve
window placement. Listing [[lst:1st-window-management]] and
[[lst:2nd-window-management]] implement a selection of his recommendations.
#+caption[Window management functions]:
#+caption: Window management functions.
#+name: lst:1st-window-management
#+begin_src emacs-lisp
(with-eval-after-load 'emacs
;; https://www.masteringemacs.org/article/demystifying-emacs-window-manager
(defun split-below (arg)
"Split window below from the parent or from root with ARG."
(interactive "P")
(split-window (if arg (frame-root-window)
(window-parent (selected-window)))
nil 'below nil))
(defun split-right (arg)
"Split window right from the parent or from root with ARG."
(interactive "P")
(split-window (if arg (frame-root-window)
(window-parent (selected-window)))
nil 'right nil))
(defun toggle-window-dedication ()
"Toggles window dedication in the selected window."
(interactive)
(set-window-dedicated-p (selected-window)
(not (window-dedicated-p (selected-window))))))
#+end_src
#+caption[Window management variables]:
#+caption: Window management variables.
#+name: lst:2nd-window-management
#+begin_src emacs-lisp
(with-eval-after-load 'emacs
;; https://www.masteringemacs.org/article/demystifying-emacs-window-manager
(custom-set-variables
'(switch-to-buffer-in-dedicated-window 'pop)
'(switch-to-buffer-obey-display-actions t))
(add-to-list 'display-buffer-alist
'("\\*Help\\*"
(display-buffer-reuse-window display-buffer-pop-up-window)
(inhibit-same-window . nil))))
#+end_src
* [[info:elisp#Advising Functions][Advising Functions (info)]]
:PROPERTIES:
:CUSTOM_ID: sec:advising-function