From d647cd8c8101ac784c01f0fb4ce5c62ebcfb3eed Mon Sep 17 00:00:00 2001 From: Constantine Vetoshev Date: Tue, 9 Mar 2021 16:25:40 -0800 Subject: Make persp-buffer-menu and persp-list-buffers consistent with built-in buffer-menu and list-buffers. --- README.md | 15 +++++++++++---- perspective.el | 12 +++++++++++- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 95b04e6..729badf 100644 --- a/README.md +++ b/README.md @@ -166,10 +166,17 @@ to use a Perspective-aware buffer switcher. in particular its `ido-switch-buffer` command, is automatically Perspective-aware when `persp-mode` is enabled. -**buffer-menu**: Perspective provides a wrapper for -[`buffer-menu`](https://www.gnu.org/software/emacs/manual/html_node/emacs/List-Buffers.html): -`persp-buffer-menu`. When this function is called normally, it shows the buffer menu filtered by the current perspective. With a prefix argument, it shows the -buffer menu of all the buffers in all perspectives. +**list-buffers / buffer-menu**: Perspective provides wrappers for the similar +[`list-buffers` and +`buffer-menu`](https://www.gnu.org/software/emacs/manual/html_node/emacs/List-Buffers.html): +`persp-list-buffers` and `persp-buffer-menu`. (Note that Emacs binds `C-x C-b` +to `list-buffers` by default.) When these functions are called normally, they +show the buffer menu filtered by the current perspective. With a prefix +argument, they show the buffer menu of all the buffers in all perspectives. (The +difference between `list-buffers` and `buffer-menu`: the former calls +`display-buffer`, i.e., may split windows depending on `display-buffer-alist`, +and the latter calls `switch-to-buffer`, i.e., flips the current window to the +buffer list buffer.) **`bs.el`**: Perspective provides a wrapper for [`bs-show`](https://www.gnu.org/software/emacs/manual/html_node/emacs/Buffer-Menus.html): diff --git a/perspective.el b/perspective.el index e1100ce..bcac3ed 100644 --- a/perspective.el +++ b/perspective.el @@ -1261,7 +1261,7 @@ PERSP-SET-IDO-BUFFERS)." (buffer-name (current-buffer)))))) (kill-buffer buffer-or-name)) -;; Buffer switching integration: buffer-menu +;; Buffer switching integration: buffer-menu. ;;;###autoload (defun persp-buffer-menu (arg) "Like the default C-x C-b, but filters for the current perspective's buffers." @@ -1269,6 +1269,16 @@ PERSP-SET-IDO-BUFFERS)." (if (and persp-mode (null arg)) (switch-to-buffer (list-buffers-noselect nil (seq-filter 'buffer-live-p (persp-current-buffers)))) + (switch-to-buffer (list-buffers-noselect)))) + +;; Buffer switching integration: list-buffers. +;;;###autoload +(defun persp-list-buffers (arg) + "Like the default C-x C-b, but filters for the current perspective's buffers." + (interactive "P") + (if (and persp-mode (null arg)) + (display-buffer + (list-buffers-noselect nil (seq-filter 'buffer-live-p (persp-current-buffers)))) (display-buffer (list-buffers-noselect)))) ;; Buffer switching integration: bs.el. -- cgit v1.0