aboutsummaryrefslogtreecommitdiff
path: root/perspective.el
diff options
context:
space:
mode:
authorgcv <gepardcv@gmail.com>2024-04-13 20:59:45 -0700
committergcv <gepardcv@gmail.com>2024-04-13 20:59:45 -0700
commitec48cb3bdda8c5ea12da89a12aa925ed1905a0b7 (patch)
tree35f3b9a978562f93f7c1150ffd1433f57920eef6 /perspective.el
parent460311b6e76f33de947908da74b6cbf66118d487 (diff)
Add persp-kill-other-buffers.
Diffstat (limited to 'perspective.el')
-rw-r--r--perspective.el13
1 files changed, 13 insertions, 0 deletions
diff --git a/perspective.el b/perspective.el
index c501ee3..6fe0f45 100644
--- a/perspective.el
+++ b/perspective.el
@@ -1605,6 +1605,19 @@ PERSP-SET-IDO-BUFFERS)."
(buffer-name (current-buffer))))))
(kill-buffer buffer-or-name))
+;; Buffer killing integration: kill all buffers in the current perspective
+;; except the current one and the perspective's scratch buffer.
+;;;###autoload
+(defun persp-kill-other-buffers ()
+ "Kill all buffers in the current perspective other than the current one.
+Also excludes the perspective's scratch buffer."
+ (interactive)
+ (when (y-or-n-p "Are you sure you want to kill all buffers in the current perspective except the current buffer? ")
+ (cl-loop for buf in (persp-current-buffers)
+ unless (or (eq buf (current-buffer))
+ (eq buf (get-buffer (persp-scratch-buffer))))
+ do (kill-buffer buf))))
+
;; Buffer switching integration: buffer-menu.
;;;###autoload
(defun persp-buffer-menu (arg)