Continue to play with window placement

This commit is contained in:
Gerard Vermeulen 2022-09-02 06:32:35 +02:00
parent 45d59c8da2
commit e6d5a257fc
1 changed files with 30 additions and 13 deletions

View File

@ -506,25 +506,30 @@ window placement. Listing [[lst:1st-window-management]] and
#+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."
(defun split-root-below (arg)
"Split window below from the root or from the parent with ARG."
(interactive "P")
(split-window (if arg (frame-root-window)
(window-parent (selected-window)))
(split-window (if arg (window-parent (selected-window))
(frame-root-window))
nil 'below nil))
(defun split-right (arg)
"Split window right from the parent or from root with ARG."
(defun split-root-right (arg)
"Split window right from the root or from the parent with ARG."
(interactive "P")
(split-window (if arg (frame-root-window)
(window-parent (selected-window)))
(split-window (if arg (window-parent (selected-window))
(frame-root-window))
nil 'right nil))
(defun toggle-window-dedication ()
(defun toggle-window-dedication ()
"Toggles window dedication in the selected window."
(interactive)
(set-window-dedicated-p (selected-window)
(not (window-dedicated-p (selected-window))))))
(set-window-dedicated-p
(selected-window) (not (window-dedicated-p (selected-window)))))
(defun make-display-buffer-matcher-function (major-modes)
"Return a lambda function to match a list of MAJOR-MODES."
(lambda (buffer-name action)
(with-current-buffer buffer-name (apply #'derived-mode-p major-modes)))))
#+end_src
#+caption[Window management variables]:
@ -538,9 +543,21 @@ window placement. Listing [[lst:1st-window-management]] and
'(switch-to-buffer-obey-display-actions t))
(add-to-list 'display-buffer-alist
'("\\*Help\\*"
`(,(rx (or "*Apropos*"
"*Help*"
"*info"))
(display-buffer-reuse-window display-buffer-pop-up-window)
(inhibit-same-window . nil))))
(inhibit-same-window . nil)))
(add-to-list 'display-buffer-alist
`(,(rx (or "*Occur*"
"*grep*"
"*xref*"))
display-buffer-reuse-window
(inhibit-same-window . nil)))
(add-to-list 'display-buffer-alist
'("\\*compilation\\*"
display-buffer-no-window
(allow-no-window . t))))
#+end_src
* [[info:elisp#Advising Functions][Advising Functions (info)]]