fix(org): oversized org-todo popup

In the presence of multiple, horizontal splits, the org-todo popup
consumes ~50% of the vertical real-estate of its northern neighbor when
created. This is due to an edge case with some failsafe code somewhere
down org-fit-window-to-buffer's stack. This fix ensures the popup is
always a sane size.

And by enabling +popup-buffer-mode in it, we ensure it will be treated
as a popup (e.g. solaire-mode will be active in it, no modeline, etc).
This commit is contained in:
Henrik Lissner 2021-07-28 15:13:38 -04:00
parent 2400e8b275
commit d189132be1

View file

@ -276,7 +276,7 @@ to tame (i.e. to get the popup manager to handle it)."
(let ((temp-buffer-show-function
(doom-rpartial #'+popup-display-buffer-stacked-side-window-fn nil)))
(with-current-buffer buffer
(hide-mode-line-mode +1))
(+popup-buffer-mode +1))
(funcall internal-temp-output-buffer-show buffer)))
(apply orig-fn args))
(apply orig-fn args)))
@ -285,17 +285,21 @@ to tame (i.e. to get the popup manager to handle it)."
"Hides the mode-line in *Org tags* buffer so you can actually see its
content and displays it in a side window without deleting all other windows.
Ugh, such an ugly hack."
:around '(org-fast-tag-selection
org-fast-todo-selection)
:around #'org-fast-tag-selection
:around #'org-fast-todo-selection
(if +popup-mode
(letf! ((defun org-fit-window-to-buffer (&optional window max-height min-height shrink-only)
(letf! ((defun read-char-exclusive (&rest args)
(message nil)
(apply read-char-exclusive args))
(defun split-window-vertically (&optional _size)
(funcall split-window-vertically (- 0 window-min-height 1)))
(defun org-fit-window-to-buffer (&optional window max-height min-height shrink-only)
(when-let (buf (window-buffer window))
(delete-window window)
(select-window
(setq window (display-buffer-at-bottom buf nil)))
(with-current-buffer buf
(setq mode-line-format nil)))
(funcall org-fit-window-to-buffer window max-height min-height shrink-only)))
(+popup-buffer-mode)))
(when (> (window-buffer-height window)
(window-height window))
(fit-window-to-buffer window (window-buffer-height window)))))
(apply orig-fn args))
(apply orig-fn args)))