On Sun, Dec 4, 2022, 00:31 Stefan Monnier <monnier@iro.umontreal.ca> wrote:.

For prefix completion, it works great.
For completion styles like `flex`, it's rarely able to complete anything.

Alright, that helps, thanks. But what use can you imagine try-completion having with an external tool like LSP or my everything.exe client which does regex-style?  Or some other external tool you can think of...

Is it perhaps that the caller of our new function might look at the tool's results for PATTERN and then, knowing the implicit style the tool is employing, use TRY-COMPLETION-FUNCTION to extend  the string being used for PATTERN at the completion locus?  This would make some sense, but then again probably only be actually useful if the caller is adept of caching the results of the calls to LOOKUP.

Else, I think we end up contacting the external tool one too many times for the same PATTERN. That's at least with the popular completion front-ends such as fido/vertico who probably go for the 'allc' immediately. 

Maybe  'external-completion-function' could be doing some per-table-per-PATTERN caching, to relieve the caller of this complication.

João