[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/ivy 1642e20 1/2: Fix ivy-restrict-to-matches for dynami
From: |
Basil L. Contovounesios |
Subject: |
[elpa] externals/ivy 1642e20 1/2: Fix ivy-restrict-to-matches for dynamic colls |
Date: |
Tue, 27 Jul 2021 11:20:14 -0400 (EDT) |
branch: externals/ivy
commit 1642e208466ed320379b5dcb9b65e4f2ceca7357
Author: Basil L. Contovounesios <contovob@tcd.ie>
Commit: Basil L. Contovounesios <contovob@tcd.ie>
Fix ivy-restrict-to-matches for dynamic colls
Other parts of Ivy, specifically ivy--wnd-cands-to-str, use
ivy-state-dynamic-collection to differentiate between programmed
completion functions and Ivy's dynamic collections. By disabling
ivy-state-dynamic-collection in ivy-restrict-to-matches, we lose
this ability. This leads to errors when collections are mishandled.
* ivy.el (ivy-restrict-to-matches): When disabling
ivy-state-dynamic-collection, also make sure that
minibuffer-completion-table no longer holds a dynamic collection.
Re: #2875.
Fixes #2893.
---
ivy.el | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/ivy.el b/ivy.el
index 5ef1a30..908f399 100644
--- a/ivy.el
+++ b/ivy.el
@@ -4877,9 +4877,16 @@ You can also delete an element from history with
\\[ivy-reverse-i-search-kill]."
(delete-minibuffer-contents)
(if (ivy-state-dynamic-collection ivy-last)
(progn
- (setf (ivy-state-dynamic-collection ivy-last) nil)
- (setf (ivy-state-collection ivy-last)
- (setq ivy--all-candidates ivy--old-cands)))
+ ;; By disabling `ivy-state-dynamic-collection', we lose the ability
+ ;; to clearly differentiate between ternary programmed completion
+ ;; functions and Ivy's unary dynamic collections (short of using
+ ;; `func-arity' or otherwise redesigning things). So we must also
+ ;; update the dynamic binding of `minibuffer-completion-table' to no
+ ;; longer hold a dynamic collection.
+ (setq minibuffer-completion-table ivy--old-cands)
+ (setq ivy--all-candidates ivy--old-cands)
+ (setf (ivy-state-collection ivy-last) ivy--old-cands)
+ (setf (ivy-state-dynamic-collection ivy-last) nil))
(setq ivy--all-candidates
(ivy--filter ivy-text ivy--all-candidates))))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [elpa] externals/ivy 1642e20 1/2: Fix ivy-restrict-to-matches for dynamic colls,
Basil L. Contovounesios <=