[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/counsel 99bf708 2/3: ivy.el (ivy--alist-to-cands): Extr
From: |
Basil L. Contovounesios |
Subject: |
[elpa] externals/counsel 99bf708 2/3: ivy.el (ivy--alist-to-cands): Extract |
Date: |
Fri, 23 Apr 2021 11:48:15 -0400 (EDT) |
branch: externals/counsel
commit 99bf708b5fff21c9434c9f5a0336f236066fd002
Author: Oleh Krehel <ohwoeowho@gmail.com>
Commit: Oleh Krehel <ohwoeowho@gmail.com>
ivy.el (ivy--alist-to-cands): Extract
---
ivy.el | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/ivy.el b/ivy.el
index e262f7e..257cd14 100644
--- a/ivy.el
+++ b/ivy.el
@@ -2214,6 +2214,13 @@ customizations apply to the current completion session."
(defvar Info-complete-menu-buffer)
+(defun ivy--alist-to-cands (alist)
+ "Transform ALIST to a list of strings."
+ (let ((i -1))
+ (mapcar (lambda (x)
+ (propertize x 'idx (cl-incf i)))
+ (all-completions "" alist))))
+
(defun ivy--reset-state (state)
"Reset the ivy to STATE.
This is useful for recursive `ivy-read'."
@@ -2335,10 +2342,7 @@ This is useful for recursive `ivy-read'."
(setq collection (sort (copy-sequence collection) sort-fn))
(setq sort nil))
(setf (ivy-state-collection ivy-last) collection)
- (setq coll (let ((i -1))
- (mapcar (lambda (x)
- (propertize x 'idx (cl-incf i)))
- (all-completions "" collection)))))
+ (setq coll (ivy--alist-to-cands collection)))
((or (functionp collection)
(byte-code-function-p collection)
(vectorp collection)