minad / consult

:mag: consult.el - Consulting completing-read
GNU General Public License v3.0
1.32k stars 111 forks source link

How to use dynamic sources in consult--multi #1147

Closed lrustand closed 2 months ago

lrustand commented 2 months ago

I'm trying to use a dynamic source in consult--multi, but it doesn't show any results from the dynamic source, only the static ones. If I put the same dynamic source in consult--read instead, it works flawlessly. Is there something that has to be done differently to make it work inside of consult--multi?

EDIT: I was mistaken about the "doesn't show any results" part. It actually throws an error, see next comment.

lrustand commented 2 months ago

Actually, it doesn't just silently fail. (I had mistakenly not unquoted it when adding it to the list). It actually returns the following error, followed by a whole lot of gibberish: Wrong type argument: plistp, #[257.

I previously had a call to consult--multi that looked like this:

(consult--multi '(source-a source-b source-c))

Now, because of performance issues in source-c I have converted it to a dynamic source that looks like this: (consult--dynamic-collection #'generate-some-strings). Using this dynamic source like this works as expected:

(consult--read (consult--dynamic-collection #'generate-some-strings))

But adding it to the original multi source like this fails with the above error:


(consult--multi `(source-a source-b ,(consult--dynamic-collection #'generate-some-strings)))