diff options
| -rw-r--r-- | CHANGELOG.md | 5 | ||||
| -rw-r--r-- | perspective.el | 13 |
2 files changed, 18 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 2a07bc1..cf47312 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - `persp-ibuffer-generate-filter-groups`: load `ibuf-ext` library if needed ([#202](https://github.com/nex3/perspective-el/issues/202)). +### Added + +- `persp-kill-other-buffers`: kill other buffers in the current perspectives. + + ## [2.18] — 2022-09-20 ### Added 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) |
