[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: |
Tue, 11 May 2021 11:52:49 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
> Looking at `completion-table-with-context’, it seems just to prepend the
> prefix after the completion happens, if a string is returned from
> `complete-with-action'.
Indeed.
> I’m struggling then to understand the point of
> completion-boundaries lookup at all.
That's catering to more complex situations.
E.g. imagine completing
foo:file/name:bar
where your code split this up into a `foo:` prefix and a `:bar` suffix,
and it uses the `completion-file-name-table` as completion table for the
"middle part".
In order to compute the overall boundaries to use when point is inside
"name", you need to add the length of the prefix to the boundaries
returned by `completion-file-name-table`.
IIUC in your case the completion-table used between prefix and suffix
will always be a "plain list" with no "nested" boundaries so you won't
need to worry about that.
Stefan