fix(mu4e): only widen the mu4e headers frame

It's a bit silly to just unconditionally widen the current frame when
you could have the mu4e headers view in another frame entirely. Instead
we can look for the mu4e headers buffer, and only widen frames where it
is the active buffer.
This commit is contained in:
TEC 2022-09-20 22:47:28 +08:00 committed by Henrik Lissner
parent 9b73ce3ad8
commit 2662d68ae8

View file

@ -245,9 +245,12 @@ is non-nil."
;; so if the header view is entered from a narrow frame, ;; so if the header view is entered from a narrow frame,
;; it's probably worth trying to expand it ;; it's probably worth trying to expand it
(defun +mu4e-widen-frame-maybe () (defun +mu4e-widen-frame-maybe ()
"Expand the frame with if it's less than `+mu4e-min-header-frame-width'." "Expand the mu4e-headers containing frame's width to `+mu4e-min-header-frame-width'."
(when (< (frame-width) +mu4e-min-header-frame-width) (dolist (frame (frame-list))
(set-frame-width (selected-frame) +mu4e-min-header-frame-width))) (when (and (string= (buffer-name (window-buffer (frame-selected-window frame)))
mu4e-headers-buffer-name)
(< (frame-width) +mu4e-min-header-frame-width))
(set-frame-width frame +mu4e-min-header-frame-width))))
(add-hook 'mu4e-headers-mode-hook #'+mu4e-widen-frame-maybe) (add-hook 'mu4e-headers-mode-hook #'+mu4e-widen-frame-maybe)
(when (fboundp 'imagemagick-register-types) (when (fboundp 'imagemagick-register-types)