From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Physical keyboard events Date: Wed, 30 Oct 2024 19:37:54 +0200 Message-ID: <86frod4hl9.fsf@gnu.org> References: <86r07z58or.fsf@gnu.org> <86froe6eq3.fsf@gnu.org> <864j4u6bug.fsf@gnu.org> <86sesd4nmy.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5990"; mail-complaints-to="usenet@ciao.gmane.io" Cc: manikulin@gmail.com, emacs-devel@gnu.org To: Yuri Khan Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Oct 30 18:38:43 2024 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 1t6CeZ-0001QY-27 for ged-emacs-devel@m.gmane-mx.org; Wed, 30 Oct 2024 18:38:43 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t6Cds-0004Pq-HJ; Wed, 30 Oct 2024 13:38:00 -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 1t6Cdq-0004Pf-2q for emacs-devel@gnu.org; Wed, 30 Oct 2024 13:37:58 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t6Cdp-0004wB-Q9; Wed, 30 Oct 2024 13:37:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=Da2Ofef1us/pCRMr/7J+e2fqurvfZevGse5L7pxA9ro=; b=jej8rca1NHz6qqLGKePA j3mgXpuxCaBky+aTz0ndtrgm4GmuIEDUXe33nAYc3qWIJbgMXJauL4d+kIXm9whYIPvWmWT4ImOgD 91YTjevLMXloD/RqWcSQGTajUOhkb21qsceR9t3FjPVFc4ward73BhYv7pslAigB+v+MfOhPVlSzT 2ENFCceNHzh/87ZTeQr9cq13GocWbqd4F00IHHnAfXHO17R3l6MtVeYpAzSvIQz78/8bFLUYfpNDT eQJ8rdflMYNx3iXUuMOd00Bl1ggwkejg5FDbRZc6DDX29h4fGl4rbrtzFzzpZaoCXNqG6m113PVY7 4wxa2gM2tWFaeg==; In-Reply-To: (message from Yuri Khan on Thu, 31 Oct 2024 00:13:31 +0700) 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: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:324948 Archived-At: > From: Yuri Khan > Date: Thu, 31 Oct 2024 00:13:31 +0700 > Cc: manikulin@gmail.com, emacs-devel@gnu.org > > On Wed, 30 Oct 2024 at 22:27, Eli Zaretskii wrote: > > > > From: Yuri Khan > > > Date: Wed, 30 Oct 2024 13:28:20 +0700 > > > Cc: emacs-devel@gnu.org > > > > I’m going to posit the hypothesis that the *only* command for which it > > > makes sense to use the keysym of the current layout is > > > ‘self-insert-command’. > > > > > > Everything else wants the keysym of “the” Latin-based layout if there > > > is one and only one; the keycode if there is none; and some heuristic > > > tiebreaker for the case where the user has more than one Latin-based > > > layout configured. > > > > How do you suggest to arrange for a low-level keyboard interface to > > know which kind of Emacs command attempted to read the keyboard? > > Since it’s not clairvoyant, it would need to save enough information > for the keymap lookup code downstream. Specifically (XKB/X11 case): > state of modifiers, keycode, keysym according to the currently active > group, and keysym according to the appropriate Latin-based group. > > Then, at the time of keymap lookup: > > * Look up the active modifiers + active group keysym. > * If this yields ‘self-insert-command’ or another command > specifically whitelisted, return that. > * Look up the active modifiers + keysym from the Latin-based group. Return that. How do you know which keymap to look up and for which character, before you decide which character to produce? > Test case: If a mode keymap binds both ‘/’ and ‘.’, and a key produces > ‘/’ in the Latin layout and ‘.’ in Cyrillic layout, then the ‘/’ > command shall be executed regardless of whether Latin or Cyrillic > layout is active. What if '/' is bound to self-insert-command, but '.' to something else: what do you return then?