emacs-devel
[Top][All Lists]
Advanced

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

Re: Turning completion table lambdas into symbols


From: Dmitry Gutov
Subject: Re: Turning completion table lambdas into symbols
Date: Fri, 1 Dec 2023 02:36:09 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0

On 29/11/2023 21:26, Spencer Baugh wrote:
For CAPF and Company, we also discussed the idea of a "session object"
some time ago, but that's not in the current API so far.
Right, I think I'd much rather some kind of "session object" at the
level of completing-read/the programmed completion API.

Do you have a link to the previous discussion?

It's been here and there, but the last mention was right in the middle of this:

https://debbugs.gnu.org/cgi/bugreport.cgi?bug=47711#272
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=47711#320

I haven't thought too much about it, but maybe some new dynamic variable
which is bound to nil at the top level of completing-read-default, so
the completion table can change it over time and preserve state through
the course of the completion.  Works fine with nested completing-reads.

That could work. If you further progress on this (in a new thread?), I suggest you tag all the interested parties (or include Stefan, at least).

Alternatively, if today a completion table is always invoked with the
same current buffer (probably the case?), we could formalize that and
just let a completion table store state in buffer-local variables.
Maybe with some new 'initialize operation in completion tables which is
called when a new completing-read starts, or maybe the completion table
can just detect that somehow and initialize the variables itself.  That
is nicer than having a single variable which all completion tables
share.  However, completion table writers would need to be careful not
to break when doing nested completing-reads on the same table.

It's not rocket science, but the hard part is to pick a protocol that's backward-compatible and weave it through all the related pieces of code.

Also see the note about backspacing around here: https://github.com/minad/corfu/wiki#configuring-corfu-for-eglot (where doing an edit before the current BEG doesn't abort completion but does make the cache invalid), but that might be something to handle in the caching logic anyway.



reply via email to

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