[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/ivy-hydra 83873c7 152/395: ivy.el (ivy--dynamic-collect
From: |
Basil L. Contovounesios |
Subject: |
[elpa] externals/ivy-hydra 83873c7 152/395: ivy.el (ivy--dynamic-collection-cands): Accept alist from dynamic-collection |
Date: |
Thu, 25 Feb 2021 08:31:51 -0500 (EST) |
branch: externals/ivy-hydra
commit 83873c735afe19e7b961ba6755a3bbd854a79da7
Author: Oleh Krehel <ohwoeowho@gmail.com>
Commit: Oleh Krehel <ohwoeowho@gmail.com>
ivy.el (ivy--dynamic-collection-cands): Accept alist from dynamic-collection
* ivy-test.el (ivy-read): Add test.
Fixes #2355
Re #2463
---
ivy-test.el | 12 +++++++++++-
ivy.el | 8 ++++++--
2 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/ivy-test.el b/ivy-test.el
index 15f3956..37b7ee1 100644
--- a/ivy-test.el
+++ b/ivy-test.el
@@ -182,7 +182,17 @@ will bring the behavior in line with the newer Emacsen."
(should (equal (ivy-with
'(ivy-read "x: " '("one" "two" ("three" . "four")))
"th C-m")
- "three")))
+ "three"))
+ (should (equal (ivy-with
+ '(ivy-read "x: "
+ (lambda (_input)
+ '(("one" . 1)
+ ("two" . 2)))
+ :dynamic-collection t
+ :action (lambda (choice)
+ (message "%s" choice)))
+ "C-m")
+ "one")))
(ert-deftest ivy-read-sort-alist ()
(should (equal (ivy-with '(let ((coll '(("b" . "1") ("a" . "2"))))
diff --git a/ivy.el b/ivy.el
index 029df86..27cf645 100644
--- a/ivy.el
+++ b/ivy.el
@@ -2390,7 +2390,7 @@ This is useful for recursive `ivy-read'."
counsel-switch-buffer)))
predicate)))
(dynamic-collection
- (setq coll (funcall collection (or initial-input ""))))
+ (setq coll (ivy--dynamic-collection-cands (or initial-input ""))))
((consp (car-safe collection))
(setq collection (cl-remove-if-not predicate collection))
(when (and sort (setq sort-fn (ivy--sort-function caller)))
@@ -3341,6 +3341,10 @@ Should be run via minibuffer `post-command-hook'."
(ivy--insert-minibuffer new-minibuffer)))
t))
+(defun ivy--dynamic-collection-cands (input)
+ (mapcar (lambda (x) (if (consp x) (car x) x))
+ (funcall (ivy-state-collection ivy-last) input)))
+
(defun ivy--update-minibuffer ()
(prog1
(if (ivy-state-dynamic-collection ivy-last)
@@ -3350,7 +3354,7 @@ Should be run via minibuffer `post-command-hook'."
coll in-progress)
(unless (equal ivy--old-text ivy-text)
(while-no-input
- (setq coll (funcall (ivy-state-collection ivy-last) ivy-text))
+ (setq coll (ivy--dynamic-collection-cands ivy-text))
(when (eq coll 0)
(setq coll nil)
(setq ivy--old-re nil)
- [elpa] externals/ivy-hydra 269583d 125/395: counsel.el (counsel-locate-cmd-es): Switch flags order, (continued)
- [elpa] externals/ivy-hydra 269583d 125/395: counsel.el (counsel-locate-cmd-es): Switch flags order, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 098f8fe 133/395: swiper.el (swiper-isearch-toggle): Fix up, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra b20a6db 135/395: counsel.el (counsel-recentf-candidates): Sort remote files better, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra d1c3613 140/395: Fix ivy-{next, previous}-line-or-history when input is empty, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 2229801 142/395: counsel.el (counsel-M-x-action): Trim left ^, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra af51ffd 139/395: ivy.el (ivy-read-action-ivy): Don't reset ivy-marked-candidates to nil, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 8f3e589 138/395: counsel.el: Add "overwrite" action to counsel-bookmark, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 6930d72 143/395: ivy.el (ivy--kill-current-candidate): Specialize and fix for buffers, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 22028d4 146/395: counsel.el (counsel--string-trim-left): Add, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra ba4c1d5 151/395: swiper.el (swiper-C-s): New command bound to "C-s" for swiper, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 83873c7 152/395: ivy.el (ivy--dynamic-collection-cands): Accept alist from dynamic-collection,
Basil L. Contovounesios <=
- [elpa] externals/ivy-hydra db45501 153/395: Add counsel-find-file action: find-file-literally, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra b83d271 171/395: ivy.el (ivy-backward-kill-word): Actually kill-word, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 4b4f7c8 163/395: swiper.el (swiper-occur): Works with marked candidates, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 3915890 172/395: ivy.el (ivy-format-function-line): Add doc about :extend t, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra ea1e4f3 165/395: ivy.el (ivy-avy): Add a warning for M-x, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 40b4705 160/395: ivy.el (ivy--dynamic-collection-cands): Handle the case of coll 0, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra c782b48 161/395: ivy.el (ivy-read-action-by-key): Fix for Emacs27, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 1933f6d 178/395: ivy.el (ivy-resume): Don't re-calculate for :dynamic-collection, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 5f1d9ce 179/395: counsel.el (counsel--grep-smart-case-flag): Extract, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 73c9773 180/395: Fix ripgrep pcre2 feature detection, Basil L. Contovounesios, 2021/02/25