From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] On the nasty "ghost key" problem on NS Date: Sat, 05 Nov 2022 11:47:24 -0400 Message-ID: References: <87leord0ei.fsf@yahoo.com> <87h6zfchpu.fsf@yahoo.com> <394D8618-AF36-44C4-BA64-7AFDFBBDC429@gmail.com> <878rkrcbkx.fsf@yahoo.com> <87sfizaria.fsf@yahoo.com> <87k04ac3s6.fsf@yahoo.com> <87cza2b59l.fsf@yahoo.com> <73CA0A70-2D98-4BC9-B474-2D69373A245A@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="619"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: Po Lu , emacs-devel@gnu.org To: Kai Ma Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Nov 05 16:48:23 2022 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1orLPD-000ATq-9Q for ged-emacs-devel@m.gmane-mx.org; Sat, 05 Nov 2022 16:48:23 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1orLOQ-0003IJ-N9; Sat, 05 Nov 2022 11:47:34 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1orLON-0003I1-3N for emacs-devel@gnu.org; Sat, 05 Nov 2022 11:47:31 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1orLOL-0003cb-98 for emacs-devel@gnu.org; Sat, 05 Nov 2022 11:47:30 -0400 Original-Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 1C980804C0; Sat, 5 Nov 2022 11:47:27 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 8179D80091; Sat, 5 Nov 2022 11:47:25 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1667663245; bh=SDMUj7yb/7QcjMuJGUyynY0EP2RINtOMKek54gRPoTM=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=poxlFNMq05oGU+E50Qz2K1bkvUi+hMIE4QxL/IB+SqpZOKFNia9oOK+AB/Llb5YhB BlCcxZfqaR9KuhVxo1TsXJh+cMLHRxLZflASgt+BHTuFZ0fjTD4Rd68a/4x0zl6v7b /s1WEH03E9kMfdkYnFfBH5Zzv7HIXRxLUtwNFVyPRe2/pC5HfQwZ97UNcusHSijC/X HRRsiVxrfaBfQj1rsee9za89tfy0WIYsDC95oKBpWTx3HMlB/TZNOnVp0cfsYuu1jW Sw4aYgWlNzFPnjR4lS44dlGk6FTciAGKX1bKPRUxL5oD7pjBLpVTPZSO/FRMQNMLWL gT6EWQC/GluKA== Original-Received: from pastel (65-110-220-202.cpe.pppoe.ca [65.110.220.202]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 56D9D12030C; Sat, 5 Nov 2022 11:47:25 -0400 (EDT) In-Reply-To: <73CA0A70-2D98-4BC9-B474-2D69373A245A@gmail.com> (Kai Ma's message of "Sat, 5 Nov 2022 23:26:35 +0800") Received-SPF: pass client-ip=132.204.25.50; envelope-from=monnier@iro.umontreal.ca; helo=mailscanner.iro.umontreal.ca X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: "Emacs-devel" Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:299214 Archived-At: > I=E2=80=99m not super familiar with the signal mechanism, but here are so= me > findings. (Assume that `waiting_for_input` is correctly maintained.) On > certain occasions (which still remain unclear to me), the `Vthrow_on_inpu= t` > path in `process_quit_flag` is taken. The curious thing is that `safe_ca= ll` > 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=E2=80=99s not. It=E2=80=99s always the main thread.) Thanks. That's good to know. Stefan