[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/counsel 27ac8f6 1/2: Let counsel-ibuffer create new buf
From: |
Basil L. Contovounesios |
Subject: |
[elpa] externals/counsel 27ac8f6 1/2: Let counsel-ibuffer create new buffers |
Date: |
Tue, 17 Aug 2021 11:10:24 -0400 (EDT) |
branch: externals/counsel
commit 27ac8f6d43c84f68c7bf45a6c0e7004b79f21805
Author: Basil L. Contovounesios <contovob@tcd.ie>
Commit: Basil L. Contovounesios <contovob@tcd.ie>
Let counsel-ibuffer create new buffers
* counsel.el (counsel-ibuffer--get-buffers): Rename...
(counsel--ibuffer-get-buffers): ...to this. All callers changed.
Fix docstring.
(counsel-ibuffer-visit-buffer)
(counsel-ibuffer-visit-buffer-other-window): Create new buffer when
input does not match a completion candidate.
Fixes #2905.
---
counsel.el | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/counsel.el b/counsel.el
index 2b33722..d83de86 100644
--- a/counsel.el
+++ b/counsel.el
@@ -5255,7 +5255,7 @@ the face to apply."
NAME specifies the name of the buffer (defaults to \"*Ibuffer*\")."
(interactive)
(setq counsel-ibuffer--buffer-name (or name "*Ibuffer*"))
- (ivy-read "Switch to buffer: " (counsel-ibuffer--get-buffers)
+ (ivy-read "Switch to buffer: " (counsel--ibuffer-get-buffers)
:history 'counsel-ibuffer-history
:action #'counsel-ibuffer-visit-buffer
:caller 'counsel-ibuffer))
@@ -5265,8 +5265,10 @@ NAME specifies the name of the buffer (defaults to
\"*Ibuffer*\")."
(declare-function ibuffer-forward-line "ibuffer")
(defvar ibuffer-movement-cycle)
-(defun counsel-ibuffer--get-buffers ()
- "Return list of buffer-related lines in Ibuffer as strings."
+(defun counsel--ibuffer-get-buffers ()
+ "Return an alist with buffer completion candidates from Ibuffer.
+The keys are buffer-related lines from Ibuffer as strings, and
+the values are the corresponding buffer objects."
(let ((oldbuf (get-buffer counsel-ibuffer--buffer-name)))
(unless oldbuf
;; Avoid messing with the user's precious window/frame configuration.
@@ -5296,11 +5298,11 @@ NAME specifies the name of the buffer (defaults to
\"*Ibuffer*\")."
(defun counsel-ibuffer-visit-buffer (x)
"Switch to buffer of candidate X."
- (switch-to-buffer (cdr x)))
+ (switch-to-buffer (or (cdr-safe x) x)))
(defun counsel-ibuffer-visit-buffer-other-window (x)
"Switch to buffer of candidate X in another window."
- (switch-to-buffer-other-window (cdr x)))
+ (switch-to-buffer-other-window (or (cdr-safe x) x)))
(defun counsel-ibuffer-visit-ibuffer (_)
"Switch to Ibuffer buffer."
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [elpa] externals/counsel 27ac8f6 1/2: Let counsel-ibuffer create new buffers,
Basil L. Contovounesios <=