From c4b5fefa6712649c637a286886bd18ac412eba8d Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sat, 11 Jul 2026 12:21:10 -0500 Subject: fix(undead-buffers): guard kill-other-window against a lone window In a single-window frame cj/kill-other-window killed the buffer being viewed: other-window no-ops, delete-window was guarded, but the kill still ran on the current buffer. Signal a user-error instead, matching the sibling cj/kill-other-window-buffer. Past the guard there's always another window, so delete-window drops its own check. The single-window test asserted the broken behavior, so I rewrote it to expect the user-error and an untouched buffer. Also documented the prefix-argument undead-mark in cj/kill-buffer-or-bury-alive. --- tests/test-undead-buffers-kill-other-window.el | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'tests') diff --git a/tests/test-undead-buffers-kill-other-window.el b/tests/test-undead-buffers-kill-other-window.el index e9371a0f..000ada9b 100644 --- a/tests/test-undead-buffers-kill-other-window.el +++ b/tests/test-undead-buffers-kill-other-window.el @@ -66,8 +66,9 @@ ;;; Boundary Cases -(ert-deftest test-kill-other-window-single-window-should-only-kill-buffer () - "With single window, should only kill the current buffer." +(ert-deftest test-kill-other-window-single-window-signals-no-other-window () + "Error: with a single window, signal `user-error' and kill nothing. +There is no other window, so acting would kill the buffer being viewed." (test-kill-other-window-setup) (unwind-protect (let ((buf (generate-new-buffer "*test-single-other*"))) @@ -75,9 +76,9 @@ (progn (switch-to-buffer buf) (should (one-window-p)) - (cj/kill-other-window) + (should-error (cj/kill-other-window) :type 'user-error) (should (one-window-p)) - (should-not (buffer-live-p buf))) + (should (buffer-live-p buf))) (when (buffer-live-p buf) (kill-buffer buf)))) (test-kill-other-window-teardown))) -- cgit v1.2.3