diff --git a/.config/emacs/init.org b/.config/emacs/init.org index 7959c57..b874db5 100644 --- a/.config/emacs/init.org +++ b/.config/emacs/init.org @@ -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) - (display-buffer-in-direction - buffer - `((window-height . 0.4) - (window-width . 0.4) - (direction . ,(joe/get-popper-dir)) - (body-function . ,#'select-window)))) + (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 . 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)