emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/bufferlo 0254201487 11/37: Add prefix argument to buffe


From: ELPA Syncer
Subject: [elpa] externals/bufferlo 0254201487 11/37: Add prefix argument to bufferlo-switch-to-buffer
Date: Sun, 5 Nov 2023 09:57:32 -0500 (EST)

branch: externals/bufferlo
commit 0254201487782d76fa07d73590a7094a486a3b22
Author: Florian Rommel <mail@florommel.de>
Commit: Florian Rommel <mail@florommel.de>

    Add prefix argument to bufferlo-switch-to-buffer
---
 README.org  |  1 +
 bufferlo.el | 16 ++++++++++------
 2 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/README.org b/README.org
index 85c5c7a273..6c128fc996 100644
--- a/README.org
+++ b/README.org
@@ -50,6 +50,7 @@ Use the bufferlo buffer-list commands as an alternative to the
 respective global commands:
 - ~bufferlo-switch-to-buffer~:
   The ~switch-to-buffer~ command filtered for local buffers.
+  Call it with the prefix argument to get the lobal list (all buffers).
 - ~bufferlo-ibuffer~:
   ~ibuffer~ filtered for local buffers.
 
diff --git a/bufferlo.el b/bufferlo.el
index bf08814fad..c2f29d3c37 100644
--- a/bufferlo.el
+++ b/bufferlo.el
@@ -390,15 +390,19 @@ If FRAME is nil, kill the current frame."
   (tab-bar-close-tab))
 
 (defun bufferlo-switch-to-buffer (buffer &optional norecord force-same-window)
-  "Display the local buffer BUFFER in the selected window.
+  "Display the BUFFER in the selected window.
+Completion includes only local buffers.
 This is the frame/tab-local equivilant to `switch-to-buffer'.
-The arguments NORECORD and FORCE-SAME-WINDOW are passed to `switch-to-buffer'."
+The arguments NORECORD and FORCE-SAME-WINDOW are passed to `switch-to-buffer'.
+If the prefix arument is given, include all buffers."
   (interactive
    (list
-    (let ((lbs (mapcar #'buffer-name (bufferlo-buffer-list))))
-      (read-buffer
-       "Switch to local buffer: " lbs nil
-       (lambda (b) (member (if (stringp b) b (car b)) lbs))))))
+    (if current-prefix-arg
+        (read-buffer "Switch to buffer: " (other-buffer (current-buffer)) nil)
+      (let ((lbs (mapcar #'buffer-name (bufferlo-buffer-list))))
+        (read-buffer
+         "Switch to local buffer: " (other-buffer (current-buffer)) nil
+         (lambda (b) (member (if (stringp b) b (car b)) lbs)))))))
   (switch-to-buffer buffer norecord force-same-window))
 
 (defun bufferlo-ibuffer ()



reply via email to

[Prev in Thread] Current Thread [Next in Thread]