Configure popper.el

This commit is contained in:
Case Duckworth 2021-10-12 00:02:51 -05:00
parent ca6b4321f3
commit 244dc53be8
1 changed files with 26 additions and 1 deletions

27
init.el
View File

@ -2332,7 +2332,32 @@ the default is \"/\"."
,(rx "Output*" eol)
,(rx "*Async Shell Command*")
help-mode helpful-mode
compilation-mode))
compilation-mode)
popper-mode-line nil
popper-display-control t
popper-display-function
(defun popper/select-popup-smartly (buffer &optional _alist)
(let* ((widep (> (frame-pixel-width) (frame-pixel-height)))
(window (display-buffer-in-side-window
buffer
`((side . ,(if widep 'right 'bottom))
(slot . 1)
,(if widep
(cons 'window-width
popper-window-height)
(cons 'window-height
popper-window-height))))))
(select-window window)))
popper-window-height
(defun popper/figure-window-height (window)
(let* ((widep (> (frame-pixel-width) (frame-pixel-height)))
(fit-window-to-buffer-horizontally widep))
(fit-window-to-buffer
window
(floor (frame-pixel-height) 2)
(floor (frame-pixel-height) 4)
fill-column
fill-column))))
(:global "M-`" #'popper-toggle-latest
"C-`" #'popper-cycle)
(popper-mode +1)