aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/custom-buffer-file.el7
-rw-r--r--modules/undead-buffers.el16
2 files changed, 22 insertions, 1 deletions
diff --git a/modules/custom-buffer-file.el b/modules/custom-buffer-file.el
index f4401d1f..ef4fc945 100644
--- a/modules/custom-buffer-file.el
+++ b/modules/custom-buffer-file.el
@@ -17,6 +17,8 @@
;;
;; Keybindings under ~C-; b~:
;; - ~C-; b k~ kill buffer and window (delete window, kill/bury buffer)
+;; - ~C-; b K~ kill the other window's buffer, keeping that window/split
+;; (cj/kill-other-window-buffer in undead-buffers.el)
;; - ~C-; b <arrow>~ move the active window's divider that way (via windsize);
;; bare arrows keep nudging until any other key (cj/window-resize-sticky in
;; ui-navigation.el)
@@ -37,8 +39,9 @@
(require 'mm-decode)
(require 'external-open) ;; for cj/xdg-open, cj/open-this-file-with
-;; cj/kill-buffer-and-window defined in undead-buffers.el
+;; cj/kill-buffer-and-window and cj/kill-other-window-buffer defined in undead-buffers.el
(declare-function cj/kill-buffer-and-window "undead-buffers")
+(declare-function cj/kill-other-window-buffer "undead-buffers")
;; cj/window-resize-sticky (C-; b <arrow>) defined in ui-navigation.el
(declare-function cj/window-resize-sticky "ui-navigation")
@@ -449,6 +452,7 @@ Signals an error if:
"n" #'cj/copy-buffer-name
"l" #'cj/copy-link-to-buffer-file
"k" #'cj/kill-buffer-and-window
+ "K" #'cj/kill-other-window-buffer
"P" #'cj/print-buffer-ps
"t" #'cj/clear-to-top-of-buffer
"b" #'cj/clear-to-bottom-of-buffer
@@ -486,6 +490,7 @@ Signals an error if:
"C-; b n" "copy buffer name"
"C-; b l" "copy file link"
"C-; b k" "kill buffer and window"
+ "C-; b K" "kill other window's buffer"
"C-; b P" "print to PS"
"C-; b t" "clear to top"
"C-; b b" "clear to bottom"
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)