From: Daniel Mendler via "Emacs development discussions." <emacs-devel@gnu.org>
To: Dmitry Gutov <dmitry@gutov.dev>
Cc: Zhengyi Fu <i@fuzy.me>, Spencer Baugh <sbaugh@janestreet.com>,
emacs-devel@gnu.org
Subject: Re: unwind-protect within while-no-input
Date: Sun, 12 May 2024 10:50:33 +0200 [thread overview]
Message-ID: <871q67za5i.fsf@daniel-mendler.de> (raw)
In-Reply-To: <4220bb78-9bb3-4b46-b674-ac0d2ef9c9f0@gutov.dev> (Dmitry Gutov's message of "Sun, 12 May 2024 04:59:22 +0300")
Dmitry Gutov <dmitry@gutov.dev> writes:
> Hi Daniel,
>
> It's good to see you in this thread.
>
> On 12/05/2024 01:08, Daniel Mendler wrote:
>
>>>> 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.
> What's your recommendation regarding the necessary cleanup inside the
> while-no-input block?
This is a general question, which applies to all situations where
asynchronous exceptions (or user interrupts) occur. One basically has to
protect all critical sections with (let ((throw-on-input nil)
(inhibit-quit t)) ...), which locally disables the exceptions.
Global state manipulations which should not be interrupted, should be
guarded. Most of the Emacs code isn't written in such an exception-safe
way. That's usually okay, as long as the state can still be recovered
somehow after an interrupt by the user. For example if buffer-local
state gets invalid, killing and reopening a buffer will solve the
problem.
However inside Capfs or other code which is very often interrupted,
greater care is necessary. Inside such a critical section, the cleanup
code could be registered somewhere, such that it doesn't get lost. The
cleanup code itself should likely be guarded too.
Daniel
next prev parent reply other threads:[~2024-05-12 8:50 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-03 12:45 unwind-protect within while-no-input Spencer Baugh
2024-05-07 18:05 ` Spencer Baugh
2024-05-07 18:49 ` Eli Zaretskii
2024-05-07 19:43 ` Spencer Baugh
2024-05-08 3:59 ` Po Lu
2024-05-08 11:42 ` Michael Heerdegen via Emacs development discussions.
2024-05-08 11:47 ` Michael Heerdegen via Emacs development discussions.
2024-05-08 13:44 ` Spencer Baugh
2024-05-08 16:13 ` Michael Heerdegen via Emacs development discussions.
2024-05-08 17:18 ` Spencer Baugh
2024-05-08 20:43 ` Michael Heerdegen via Emacs development discussions.
2024-05-09 12:57 ` Spencer Baugh
2024-05-09 14:13 ` Michael Heerdegen via Emacs development discussions.
2024-05-08 12:12 ` Eli Zaretskii
2024-05-08 12:36 ` Michael Heerdegen via Emacs development discussions.
2024-05-08 11:52 ` Eli Zaretskii
2024-05-08 13:57 ` Spencer Baugh
2024-05-08 14:18 ` Eli Zaretskii
2024-05-08 14:38 ` Spencer Baugh
2024-05-08 15:06 ` Eli Zaretskii
2024-05-08 15:14 ` Spencer Baugh
2024-05-08 18:51 ` Eli Zaretskii
2024-05-08 19:28 ` Spencer Baugh
2024-05-09 5:46 ` Eli Zaretskii
2024-05-09 13:07 ` Spencer Baugh
2024-05-09 17:41 ` Dmitry Gutov
2024-05-11 9:48 ` Eli Zaretskii
2024-05-11 10:37 ` Eshel Yaron
2024-05-11 10:42 ` Zhengyi Fu
2024-05-11 21:45 ` Dmitry Gutov
2024-05-11 22:08 ` Daniel Mendler via Emacs development discussions.
2024-05-12 1:59 ` Dmitry Gutov
2024-05-12 8:50 ` Daniel Mendler via Emacs development discussions. [this message]
2024-05-12 11:49 ` Dmitry Gutov
2024-05-14 21:30 ` Dmitry Gutov
2024-05-26 2:49 ` Stefan Monnier via Emacs development discussions.
2024-05-26 15:36 ` Dmitry Gutov
2024-05-26 18:00 ` Stefan Monnier
2024-05-26 22:56 ` Dmitry Gutov
2024-05-29 0:39 ` Stefan Monnier
2024-05-29 1:17 ` Dmitry Gutov
2024-05-08 20:34 ` Michael Heerdegen via Emacs development discussions.
2024-05-08 16:17 ` Michael Heerdegen via Emacs development discussions.
2024-05-26 2:47 ` Stefan Monnier via Emacs development discussions.
2024-05-26 4:36 ` Stefan Monnier
2024-05-26 4:55 ` Eli Zaretskii
2024-05-26 18:12 ` Stefan Monnier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=871q67za5i.fsf@daniel-mendler.de \
--to=emacs-devel@gnu.org \
--cc=dmitry@gutov.dev \
--cc=i@fuzy.me \
--cc=mail@daniel-mendler.de \
--cc=sbaugh@janestreet.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.