From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: James Thomas Newsgroups: gmane.emacs.help Subject: Re: emacs term-keys, and describe-prefix-translations Date: Fri, 27 Dec 2024 06:43:55 +0530 Message-ID: <86cyhekjvw.fsf@gmx.net> References: 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="24207"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Fri Dec 27 02:14:42 2024 Return-path: Envelope-to: geh-help-gnu-emacs@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 1tQyw5-0006BL-MR for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 27 Dec 2024 02:14:41 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tQyvc-0008C5-DL; Thu, 26 Dec 2024 20:14:12 -0500 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 1tQyvY-0008Bu-CV for help-gnu-emacs@gnu.org; Thu, 26 Dec 2024 20:14:09 -0500 Original-Received: from mout.gmx.net ([212.227.17.20]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tQyvW-0008Iy-4E for help-gnu-emacs@gnu.org; Thu, 26 Dec 2024 20:14:07 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.net; s=s31663417; t=1735262042; x=1735866842; i=jimjoe@gmx.net; bh=ZsYA1YaAcndfjsY4WSwFSE53lcBhkW31qeb2yF0SePs=; h=X-UI-Sender-Class:From:To:Subject:In-Reply-To:References:Date: Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:cc: content-transfer-encoding:content-type:date:from:message-id: mime-version:reply-to:subject:to; b=M9uSxinoeONzUPCoahzJzZH0VzWnBhNHfO1H/8qH9s4r50nDerP8H30ROK7eIQi1 ZioAgbaXml5kzUImTPdvrCUSDhkQsOmEi3niL7Ynhm9S/ksjWR+d85RNiMA9HslwF q7qbPcNNMrb+wUf2Yg6475KEy6O2uRpSzbTJqk6gQIIB6g+OHvWaIEBkTNeC2twaO 4iGtJrZlC++/Caio9GI2vH881jDFogoG+X9OeewAdZ1UxFUFwwbHlg7ISV6M5MV/Z LD638fyWoF8+bDKRXrkN+++IFqutm2w8XUfKm/g8gLR/+T2DdFLUX71m3XYYzj8c0 t3vcDnkIG7fP/ieORQ== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Original-Received: from user-Inspiron-3493 ([42.108.29.83]) by mail.gmx.net (mrgmx104 [212.227.17.174]) with ESMTPSA (Nemesis) id 1MtOGU-1tfbrb0RYc-00rEP5 for ; Fri, 27 Dec 2024 02:14:01 +0100 In-Reply-To: (Madhu's message of "Tue, 03 Dec 2024 12:21:15 +0530") X-Provags-ID: V03:K1:rmeMYesI33OPR0Ipsj5sFLbSBFxMZwOgqm5NXh3A8FAr79RH8Zt 4I/kAFX/SdtRxaM5D3MDFLqAyNK7ZwcnQy0qw9tgJmNGk+uQyC1gBUjBqTokjdxOhGVVP8t ZFfStqIBcHs+tM8RppxULOpHX8TND5BLXXImjdTjMeXZUe0SyXYyKkxxhHGAjjC0scO4W4J X41Yp+TXngR8Qbi08vmlQ== UI-OutboundReport: notjunk:1;M01:P0:SFgqJ2y5Kp4=;ZAvQD3RR3TuyFifvRwBmNT2eaav GVdNSUxP7RN/E+CfQJKnONlks1C0sIeTYo7tVd4GL6k1Tlm/P5z0cNz/eU2n6we5JteJ+Z0TJ uh7F8Qryn8Cmah8SpxWy7rMpRRF/47+vBftFmxDHUN+9G6EZhhl2cdnq97nJD8zgcwKySSZ1X Nq9988sNPc8zHCFD7BRzAw1iGvLzTwZ1SM6eyq2pH3OmTEuHIbbpKm6KjaWkp4POc1tnjRu7S bSliUoWvFRjzNRdAJL/AQUoKSFxh12a5AN5ijz2NYL6C9nc714nW4brPUAZlg+DKEGY6OZZ83 smKr+JNKsEM9y+QAZzJQtVX2wiwFWz+sdCygvrDRUYoURmsg00oR1I5XQXWAulaIGczEDI//Y 7nKi3pWf98kb0qijNFgwdcBRkrv84tiLNtAG1YcJVL32zHbG62qs7oNNKdz27mBvNsDVNy/ZA V11oqRWMekdTFooKoQ52iUrcLAcaBRk4ngchmrid3tFRTLvCoK001z+sUHpFtTTLrJRMIm9FH /0742iZzJzofUg+nCaskKAkfrm75L4G/vVRRUs36rDxfzFn0SLRMRxEYXDUxsOccq5U1qYfU0 evLLYJ3R5WIBkL46JKh5Q892NIA68w7gfxYgDNjBwNcaB2B0h8hNQf/UyXKvWS79Tu0Q1uWJ2 dfmCyiLa+VKZ08y66cMkwd6DXgDT+qd07FtVZeZkMdK5uGAR+Nha8SQcNFyX/AhZKcZgRydQW Yu1Y8E299zfBUHDvlsPJx85mn6KtIvKe2/bAg0UNd7kr+6QaXWByboadNEOovT/Fl1JFUpjD Received-SPF: pass client-ip=212.227.17.20; envelope-from=jimjoe@gmx.net; helo=mout.gmx.net X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:149015 Archived-At: Madhu wrote: > When trying to use term-keys > (actually my gh clone of it) to handle Super- bindings in the terminal, > I run into behaviour that I do not understand, which I detail below > where "s-s" works but "s-d" doesn't. > > term-keys works by arranging for "xterm" (and other terms) to send > escape codes and setting up input-decode-map on emacs terminal frames to > handle them. > > for xterm my config sets up these overrides via Xresources > *VT100.Translations:#override > > ``` > ~Shift ~Ctrl ~Meta Super ~Hyper ~Alt s : string(0x1b) str= ing(0x1f) string(0x3e) string(0x68) string(0x1f) \n\ > ~Shift ~Ctrl ~Meta Super ~Hyper ~Alt d : string(0x1b) str= ing(0x1f) string(0x3f) string(0x48) string(0x1f) \n\ > ``` > > and typing "Super-s" and "Super-d" under "showkeys -a" in any terminal > produces the following. > > ``` > $ showkey -a > Press any keys - Ctrl-D will terminate this program > > ^[^_>h^_ 27 0033 0x1b > 31 0037 0x1f > 62 0076 0x3e > 104 0150 0x68 > 31 0037 0x1f > ^[^_?H^_ 27 0033 0x1b > 31 0037 0x1f > 63 0077 0x3f > 72 0110 0x48 > 31 0037 0x1f > ``` > > On the emacs side, term-keys-init does the equivalent of calling > > ``` > (define-key input-decode-map (string #x1b #x1f #x3e #x68 #x1f) > (kbd "s-s")) > (define-key input-decode-map (string #x1b #x1f #x3f #x48 #x1f) > (kbd "s-d")) > > ``` > > And can is verified with lookup-key. > > **HERE** > Now calling Super-s on the terminal correctly produces "s-s is > undefined" > > but calling Super-d produces a help screen with the input decoding map > translations for C-M-_ > > view-lossage has an entry: > ESC C-_ ? ;; describe-prefix-bindings > > and the (info "(elisp) Help Functions") has > > ``` > The help character is special after prefix keys, too. If it has no > binding as a subcommand of the prefix key, it runs > =E2=80=98describe-prefix-bindings=E2=80=99, which displays a list of all = the subcommands > of the prefix key. > ``` > > Is the input keymap machinery doing the right thing here in > interpreting the escape sequence for "d" > > (lookup-key input-decode-map (string #x1b #x1f #x3e #x68)) > =3D> (keymap (31 . [8388723])) > > as a key sequence which calls the prefix-help-command? I haven't looked closely at all of this, but are you sure 's-d' is not intercepted by some translation map within emacs itself? --