diff options
| author | Craig Jennings <c@cjennings.net> | 2026-05-11 15:35:43 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-05-11 15:35:43 -0500 |
| commit | 0ddbcde1e9f17021377f4160b39cd0790afcbdcc (patch) | |
| tree | d1872d799dc7554b128989411a23b9cad65a6671 /modules/undead-buffers.el | |
| parent | f837e5f7464932fc49c10a7442dc1a23af61b257 (diff) | |
| download | dotemacs-0ddbcde1e9f17021377f4160b39cd0790afcbdcc.tar.gz dotemacs-0ddbcde1e9f17021377f4160b39cd0790afcbdcc.zip | |
feat(window): kill the other window's buffer with C-; b K
`cj/kill-other-window-buffer' (in undead-buffers.el, on `C-; b K') kills or buries the buffer shown in the other window and leaves that window and the split alone. The window just shows whatever bury/kill surfaces next. It reuses `cj/kill-buffer-or-bury-alive', so buffers in `cj/undead-buffer-list' (like `*scratch*') get buried. With more than two windows it acts on `next-window'. Sibling of `cj/kill-other-window' (M-S-o), which deletes the other window. This one keeps it.
Diffstat (limited to 'modules/undead-buffers.el')
| -rw-r--r-- | modules/undead-buffers.el | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/modules/undead-buffers.el b/modules/undead-buffers.el index f79afb4b..c85bde94 100644 --- a/modules/undead-buffers.el +++ b/modules/undead-buffers.el @@ -8,6 +8,8 @@ ;; ;; Additional helper commands and key bindings: ;; - C-; b k (=cj/kill-buffer-and-window=): delete this window and bury/kill its buffer. +;; - C-; b K (=cj/kill-other-window-buffer=): bury/kill the other window's buffer, +;; keeping that window and the split intact. ;; - M-O (=cj/kill-other-window=): delete the next window and bury/kill its buffer. ;; - M-M (=cj/kill-all-other-buffers-and-windows=): kill or bury all buffers except ;; the current one and delete all other windows. @@ -77,6 +79,20 @@ ARG is passed to `save-some-buffers'." (cj/kill-buffer-or-bury-alive buf))) (keymap-global-set "M-S-o" #'cj/kill-other-window) +(defun cj/kill-other-window-buffer () + "Kill or bury the buffer shown in the other window, keeping that window +and the split intact -- the window then shows whatever bury/kill surfaces +next. With more than two windows, acts on `next-window'. + +Sibling of `cj/kill-other-window', which deletes the other window; here the +split is preserved. Buffers in `cj/undead-buffer-list' are buried." + (interactive) + (if (one-window-p) + (user-error "No other window") + (with-selected-window (next-window) + (cj/kill-buffer-or-bury-alive (current-buffer))))) +;; Keybinding in custom-buffer-file.el (C-; b K) + (defun cj/kill-all-other-buffers-and-windows () "Kill or bury all other buffers, then delete other windows." (interactive) |
