emacs-devel
[Top][All Lists]
Advanced

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

Re: unwind-protect within while-no-input


From: Dmitry Gutov
Subject: Re: unwind-protect within while-no-input
Date: Thu, 9 May 2024 20:41:46 +0300
User-agent: Mozilla Thunderbird

On 09/05/2024 16:07, Spencer Baugh wrote:
The correct solution to these problems is to document the requirements
of your function from the callers, and let the callers deal with that
according to their needs.  (I suspect that in the case that bothers
you, you yourself are that caller, which makes it easier to implement
such protocols.)

Btw, you never explained why you are bothered specifically by
while-no-input.  Nor did you describe the problem.
I'm writing a completion-at-point-function and completion table.  This
table internally uses asynchronous subprocesses to get completions.

This completion-at-point-function and table may be called by the popular
completion frontend corfu-mode.  corfu-mode uses while-no-input around
calls to completion tables.

I want to ensure that my asynchronous subprocesses are deleted even if
my code is interrupted by corfu's while-no-input.

I can't change the protocol of completion tables or
completion-at-point-functions (that's defined by Emacs), and I'm not the
one calling while-no-input (that's corfu-mode).

And for some extra context: one of the questions at this point is whether company-mode should also use while-no-input around completion table queries (for better responsiveness, naturally), or at least provide an opt-in way to do so.

I wasn't sure there is a safe way to implement completion tables inside such amended protocol (this is finicky stuff, after all), and suggested Spencer asks on the mailing list.

The question is specifically about while-no-input, though I suppose any good solution for it should be safe against C-g too.



reply via email to

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