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: Daniel Mendler
Subject: Re: unwind-protect within while-no-input
Date: Sun, 12 May 2024 00:08:38 +0200
User-agent: Gnus/5.13 (Gnus v5.13)

Dmitry Gutov <dmitry@gutov.dev> writes:

> On 11/05/2024 13:42, Zhengyi Fu wrote:
>>> 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).
>>>
>> Is cape-wrap-noninterruptible from the cape package helpful?
>
> It should help, but it would be odd if any non-trivial completion function 
> would
> need to use cape to function inside corfu-mode reliably.

cape-wrap-noninterruptible and similarly cape-wrap-silent and
cape-wrap-purify are meant as stop gap measures, used to wrap non-robust
Capfs, until they are improved. There are multiple Capfs in the wild
which regularly print messages or throw unexpected errors. For example,
pcomplete-completions-at-point even modified the buffer until Emacs 29,
which could be mitigated with cape-wrap-purify.

Daniel



reply via email to

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