On Apr 3, 2021, at 11:20 PM, Stefan Monnier <monnier@iro.umontreal.ca> wrote:

I’m confused by why `completion-table-with-cache’ needs to test:

(string-prefix-p last-arg arg ignore-case)

This was designef for completion-tables in general (rather than only
those used in a particular kind of situation).  Furthermore, even
a single M-TAB completion may easily query the completion table several
times with different prefix strings (because of `completion-styles`).

Thanks, I get it.  Since iPython’s suggestions will never change for the same line of input, perhaps caching them “once and forever” in a given collection function will be OK.  This presumes of course that none of the possible cases for long term use of a collection function will operate on distinct lines of input.  I need to work out some issues on iPython’s completer backend; will revisit once that’s working well.