mu4e-window: disable functionp mu4e-split-window for now

Set it to 'horizontal. It didn't quite work with the new window handling
code, such that mu4e was not functional. So let's restore the basics at
least.
This commit is contained in:
Dirk-Jan C. Binnema 2022-12-13 00:58:54 +02:00
parent 8e15f9571a
commit f7fe4fea21
1 changed files with 47 additions and 43 deletions

View File

@ -235,49 +235,53 @@ modifying `display-buffer-alist'.
If `mu4e-split-view' is a function, then it must return a live window If `mu4e-split-view' is a function, then it must return a live window
for BUFFER-OR-NAME to be displayed in." for BUFFER-OR-NAME to be displayed in."
(if (functionp mu4e-split-view) ;; For now, using a function for mu4e-split-view is not behaving well
(set-window-buffer (funcall mu4e-split-view) buffer-or-name) ;; Turn off.
(let* ((buffer-name (or (get-buffer buffer-or-name) (when (functionp mu4e-split-view)
(error "Buffer `%s' does not exist" buffer-or-name))) (mu4e-message "Function for `mu4e-split-view' not supported; fallback")
(buffer-type (with-current-buffer buffer-name (mu4e--get-current-buffer-type))) (setq mu4e-split-view 'horizontal))
(direction (cons 'direction
(pcase (cons buffer-type mu4e-split-view) (let* ((buffer-name (or (get-buffer buffer-or-name)
;; views or headers can display (mu4e-error "Buffer `%s' does not exist" buffer-or-name)))
;; horz/vert depending on the value of (buffer-type (with-current-buffer buffer-name (mu4e--get-current-buffer-type)))
;; `mu4e-split-view' (direction (cons 'direction
(`(,(or 'view 'headers) . horizontal) 'below) (pcase (cons buffer-type mu4e-split-view)
(`(,(or 'view 'headers) . vertical) 'right) ;; views or headers can display
(`(,_ . t) nil)))) ;; horz/vert depending on the value of
(window-size ;; `mu4e-split-view'
(pcase (cons buffer-type mu4e-split-view) (`(,(or 'view 'headers) . horizontal) 'below)
;; views or headers can display (`(,(or 'view 'headers) . vertical) 'right)
;; horz/vert depending on the value of (`(,_ . t) nil))))
;; `mu4e-split-view' (window-size
('(view . horizontal) '((window-height . shrink-window-if-larger-than-buffer))) (pcase (cons buffer-type mu4e-split-view)
('(view . vertical) '((window-min-width . fit-window-to-buffer))) ;; views or headers can display
(`(,_ . t) nil))) ;; horz/vert depending on the value of
(window-action (cond ;; `mu4e-split-view'
((and (eq buffer-type 'compose) mu4e-compose-in-new-frame) ('(view . horizontal) '((window-height . shrink-window-if-larger-than-buffer)))
'(display-buffer-pop-up-frame)) ('(view . vertical) '((window-min-width . fit-window-to-buffer)))
((memq buffer-type '(headers compose)) (`(,_ . t) nil)))
'(display-buffer-reuse-mode-window display-buffer-same-window)) (window-action (cond
((memq mu4e-split-view '(horizontal vertical)) ((and (eq buffer-type 'compose) mu4e-compose-in-new-frame)
'(display-buffer-in-direction)) '(display-buffer-pop-up-frame))
((memq mu4e-split-view '(single-window)) ((memq buffer-type '(headers compose))
'(display-buffer-same-window)) '(display-buffer-reuse-mode-window display-buffer-same-window))
;; I cannot discern a difference between ((memq mu4e-split-view '(horizontal vertical))
;; `single-window' and "anything else" in '(display-buffer-in-direction))
;; `mu4e-split-view'. ((memq mu4e-split-view '(single-window))
(t '(display-buffer-same-window)))) '(display-buffer-same-window))
(arg `((display-buffer-reuse-window ;; I cannot discern a difference between
display-buffer-reuse-mode-window ;; `single-window' and "anything else" in
,@window-action) ;; `mu4e-split-view'.
,@window-size (t '(display-buffer-same-window))))
,direction (arg `((display-buffer-reuse-window
))) display-buffer-reuse-mode-window
(funcall (if select #'pop-to-buffer #'display-buffer) ,@window-action)
buffer-name ,@window-size
arg)))) ,direction
)))
(funcall (if select #'pop-to-buffer #'display-buffer)
buffer-name
arg)))
(defun mu4e-resize-linked-headers-window () (defun mu4e-resize-linked-headers-window ()
"Resizes the linked headers window belonging to a view. "Resizes the linked headers window belonging to a view.