aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-05-26 14:28:18 -0500
committerCraig Jennings <c@cjennings.net>2026-05-26 14:28:18 -0500
commita0b027d6b4e4ba4edd2d7ca1d622d449694d2e45 (patch)
tree63c11d0036eca27a11e6b7170e338a344ccc4614 /tests
parent387a9b17e7686e8b5875cf3c435a8797df9a4ec7 (diff)
downloaddotemacs-a0b027d6b4e4ba4edd2d7ca1d622d449694d2e45.tar.gz
dotemacs-a0b027d6b4e4ba4edd2d7ca1d622d449694d2e45.zip
feat(mail): keep mu4e's main view from deleting the window split
mu4e's main view displays with a display-buffer-full-frame action, which tears down every other window on launch, so opening mu4e from a split collapsed the layout. mu4e's own mu4e-display-buffer docstring points to display-buffer-alist as the supported override. I added an entry routing the *mu4e-main* buffer to the current window (reuse a window already showing it first, then same-window), so launching mu4e in a split keeps the rest of the layout intact. It's registered eagerly rather than inside mu4e's deferred config so it applies on the first launch. Tests cover the entry registration and that the main buffer no longer collapses a split under mu4e's full-frame action.
Diffstat (limited to 'tests')
-rw-r--r--tests/test-mail-config-mu4e-window.el42
1 files changed, 42 insertions, 0 deletions
diff --git a/tests/test-mail-config-mu4e-window.el b/tests/test-mail-config-mu4e-window.el
new file mode 100644
index 000000000..e02a7f9ac
--- /dev/null
+++ b/tests/test-mail-config-mu4e-window.el
@@ -0,0 +1,42 @@
+;;; test-mail-config-mu4e-window.el --- mu4e main-view window placement -*- lexical-binding: t; -*-
+
+;;; Commentary:
+;; mu4e's main view defaults to a display-buffer-full-frame action that deletes
+;; the window split on launch. mail-config registers a display-buffer-alist
+;; entry routing the "*mu4e-main*" buffer to the current window instead. These
+;; verify the entry is registered and that, with it active, displaying the main
+;; buffer under mu4e's own full-frame action no longer collapses a split.
+
+;;; Code:
+
+(require 'ert)
+(require 'mail-config)
+
+(ert-deftest test-mail-config-mu4e-main-entry-registered ()
+ "Normal: the *mu4e-main* alist entry avoids the full-frame action."
+ (let ((entry (assoc "\\`\\*mu4e-main\\*\\'" display-buffer-alist)))
+ (should entry)
+ (should (memq 'display-buffer-same-window (cadr entry)))
+ (should-not (memq 'display-buffer-full-frame (cadr entry)))))
+
+(ert-deftest test-mail-config-mu4e-main-keeps-split ()
+ "Normal: displaying *mu4e-main* under the full-frame action keeps the split.
+The registered alist entry takes precedence over the action passed to
+`display-buffer', so the sibling window survives."
+ (let ((a (get-buffer-create "*mail-win-test-a*"))
+ (main (get-buffer-create "*mu4e-main*")))
+ (unwind-protect
+ (save-window-excursion
+ (delete-other-windows)
+ (set-window-buffer (selected-window) a)
+ (split-window (selected-window) nil t) ;; side-by-side, batch-friendly
+ (let ((n (count-windows)))
+ (display-buffer main '(display-buffer-reuse-window
+ display-buffer-reuse-mode-window
+ display-buffer-full-frame))
+ (should (= (count-windows) n))))
+ (ignore-errors (kill-buffer a))
+ (ignore-errors (kill-buffer main)))))
+
+(provide 'test-mail-config-mu4e-window)
+;;; test-mail-config-mu4e-window.el ends here