[Emacs] Mu4e react to window width rather than frame width

Referring to the previous commit, it is actually better if the mu4e
headers view sets its own width _when a message is opened_ and not
when the headers view itself is opened. This commit also makes it so
that the width is evaluated based on the width of the window of the
headers view’s window rather than the width of the frame since the
message will be opened in a new window that will spawn in the headers
view's window.
This commit is contained in:
Lucien Cartier-Tilet 2020-09-04 12:05:05 +02:00
parent 988596a904
commit d50f38db49
Signed by: phundrak
GPG Key ID: BD7789E705CB8DCA

View File

@ -3227,12 +3227,13 @@
horizontal. And to make it more readable, the header window will only occupy horizontal. And to make it more readable, the header window will only occupy
40% of Emacs frame, the rest will be given to emails. As you can see, the 40% of Emacs frame, the rest will be given to emails. As you can see, the
width of the mu4e headers is evaluated each time we enter it, so it can react width of the mu4e headers is evaluated each time we enter it, so it can react
to the frame being potentially not the same width than earlier. to the frame being potentially not the same width than earlier or the window
not taking the entire frame.
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(setq mu4e-split-view 'vertical) (setq mu4e-split-view 'vertical)
(add-hook 'mu4e-headers-mode-hook (add-hook 'mu4e-view-mode-hook
(lambda () (lambda ()
(setq mu4e-headers-visible-columns (round (* (frame-total-cols) (setq mu4e-headers-visible-columns (round (* (window-width)
0.4))))) 0.4)))))
#+END_SRC #+END_SRC