Slightly better popper window management, still WIP

This commit is contained in:
Joseph Ferano 2023-02-16 10:09:49 +07:00
parent 920e98bb32
commit 68bcc8c697

View File

@ -728,7 +728,7 @@ The theme of `C-x 4` bindings is that they operate on other windows, so this fun
helpful-mode))
(global-set-key (kbd "C-`") 'popper-toggle-latest)
(global-set-key (kbd "M-`") 'popper-cycle)
(global-set-key (kbd "C-~") 'popper-cycle)
(global-set-key (kbd "C-M-`") 'popper-toggle-type)
(require 'popper-echo)
(popper-echo-mode t)
@ -741,12 +741,29 @@ The theme of `C-x 4` bindings is that they operate on other windows, so this fun
;; TODO Consider adding checks for vertical splits and only popup on right if so
(defun joe/popper-display-func (buffer &optional _alist)
(cond
((cl-find-if
(lambda (window)
(with-current-buffer (window-buffer window) popper-popup-status))
(window-list))
(display-buffer-reuse-window
buffer
`((body-function . ,#'select-window))))
((and (not (window-in-direction 'right))
(not (window-in-direction 'left)))
(display-buffer-in-direction
buffer
`((window-height . 0.4)
(window-width . 0.4)
(direction . ,(joe/get-popper-dir))
(direction . right)
(body-function . ,#'select-window))))
(t
(display-buffer-in-direction
buffer
`((window-height . 0.4)
(window-width . 0.4)
(direction . below)
(body-function . ,#'select-window))))))
(setq popper-display-function #'joe/popper-display-func)