From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Kai Ma <justksqsf@gmail.com>
Cc: Po Lu <luangruo@yahoo.com>, emacs-devel@gnu.org
Subject: Re: [PATCH] On the nasty "ghost key" problem on NS
Date: Sat, 05 Nov 2022 11:47:24 -0400 [thread overview]
Message-ID: <jwvh6zdqutg.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <73CA0A70-2D98-4BC9-B474-2D69373A245A@gmail.com> (Kai Ma's message of "Sat, 5 Nov 2022 23:26:35 +0800")
> I’m not super familiar with the signal mechanism, but here are some
> findings. (Assume that `waiting_for_input` is correctly maintained.) On
> certain occasions (which still remain unclear to me), the `Vthrow_on_input`
> path in `process_quit_flag` is taken. The curious thing is that `safe_call`
> does not seem to catch that, and thus the control flow directly moves to
> somewhere above the Lisp call in `firstRectForCharacterRange`. Is it
> intentional that `safe_call` does not catch throw_on_input?
The implementation of `safe_call` protects against uses of `signal` but
not `throw`. Is this intentional? Good question. AFAIK we don't
currently have a mechanism to catch all throws like we have for signals,
so that might be the explanation.
FWIW, my initial implementation of `while-no-input` used `signal` rather
than `throw` and Richard insisted that it was wrong and should use
`throw` instead. I couldn't see any reason to prefer one over the other
(except that it was easier to use `signal`, hence my original choice).
AFAICT this is the first time I encounter where it seems to make
a difference :-)
Maybe this is telling us that I was right all along and `while-no-input`
should use `signal` rather than `throw`? :-)
Then again, `ns-in-echo-area` and other functions called by `safe_call`
could explicitly call `throw` for all kinds of reasons, and it's not
clear what we should do in those cases: should we disallow/catch them
all, or let them all through? Something in-between?
I wonder why it matters here and not in other uses of `safe_call`?
> (Also a correction: I guessed it could be related to threading at first.
> No, it’s not. It’s always the main thread.)
Thanks. That's good to know.
Stefan
next prev parent reply other threads:[~2022-11-05 15:47 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-03 18:07 [PATCH] On the nasty "ghost key" problem on NS Kai Ma
2022-11-04 0:32 ` Po Lu
2022-11-04 6:28 ` Kai Ma
2022-11-04 7:16 ` Po Lu
2022-11-04 8:53 ` Kai Ma
2022-11-04 9:29 ` Po Lu
2022-11-04 11:04 ` Kai Ma
2022-11-04 11:27 ` Po Lu
2022-11-04 12:09 ` Kai Ma
2022-11-04 12:17 ` Po Lu
2022-11-04 15:09 ` Stefan Monnier
2022-11-05 0:43 ` Po Lu
2022-11-05 14:40 ` Stefan Monnier
2022-11-05 15:26 ` Kai Ma
2022-11-05 15:47 ` Stefan Monnier [this message]
2022-11-06 0:25 ` Po Lu
2022-11-10 11:59 ` Kai Ma
2022-11-10 12:25 ` Po Lu
2022-11-12 17:49 ` Stefan Monnier
2022-11-04 11:40 ` Eli Zaretskii
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=jwvh6zdqutg.fsf-monnier+emacs@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=emacs-devel@gnu.org \
--cc=justksqsf@gmail.com \
--cc=luangruo@yahoo.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.