emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Recommendation for CAPF setup when you don't know completion string


From: Stefan Monnier
Subject: Re: Recommendation for CAPF setup when you don't know completion string in advance
Date: Sat, 03 Apr 2021 19:49:41 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

> So it’s a quandary: I won’t yet know `beg’ and `end’ until _after_
> interacting with iPython.  Is there any way to “revise” ‘beg’ and ‘end’ in
> a collection function returned from a CAPF?

Indeed, that's a problem.
You might be able to get away with the following:

Make your CAPF function return a beg..end that covers "the whole line"
and which returns a completion table in the form of a function.
That function will then defer to the iPython code for the grunt of its
work and will return the "real" boundaries via the
`completion-boundaries` method.  This will probably require some caching
in the completion table so we don't call iPython too many times for
a single completion (like once for `completion-boundaries`, once for
`try-completion`, once for `all-completions`, etc...).

The completion is written under the assumption that
`completion-boundaries` is cheaper to perform than `all-completions`,
so there's a risk it won't work very well, but my intuition tells me it
should work "well enough".


        Stefan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]