-
-
Notifications
You must be signed in to change notification settings - Fork 338
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ivy-update-candidates
does not work in :action
#2775
Comments
Would doing something like what The crux being that, like in #2715, |
Thank you, those functions (especially |
It's up to you.
That depends on what |
Hi @nbfalcon @basil-conto (if (and
ivy--old-re
ivy--old-cands
(equal re ivy--old-re))
;; quick caching for "C-n", "C-p" etc.
ivy--old-cands As you can see, if cache is usable, @nbfalcon If you make a small change to you code as follows, you'll get the expected result. (ivy-read "> " '("1" "2" "q'")
:action (lambda (a)
(message "M")
(setq ivy--old-cands nil) ;; this makes ivy--filter not return cached candidates
(ivy-update-candidates '("q" "5")))
:require-match t
:caller 'q) So, IMHO in |
Thanks, sounds reasonable. But then like I said I'm not familiar with the intention/design behind |
|
This issue came up when I was trying to implement a
counsel-kill-buffer
command. Calling the action usingivy-call
should remove it from the buffer list, since killing a buffer twice is impossible. However, for some strange reason, the old candidates were restored after my action was called. To reproduce, evaluate the following in a *scratch* buffer:Then call
ivy-call
. Afterwards, the candidate list should be "q" "5", but it was still "1 2 3".Debugging this further (C-u C-M-x
ivy-call
), I noticed that the candidates were indeed updated after my action was called and stayed that way until the minibuffer was selected again, after whichivy--exhibit
probably reset them again. Adding(setf (ivy-state-collection ivy-last) cands)
at the start ofivy-update-candidates
didn't help, either.Even though
internal-complete-buffer
is handled specially inivy--update-minibuffer
, this bug also shows up if the former is used asCANDIDATES
.I suspect that somewhere around
ivy--exhibit
the list of candidates is saved and restored somehow, so thativy--all-candidates
and(ivy-state-collection ivy-last)
get out of sync.The text was updated successfully, but these errors were encountered: