unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: James Thomas <jimjoe@gmx.net>
To: help-gnu-emacs@gnu.org
Subject: Re: emacs term-keys,  and describe-prefix-translations
Date: Fri, 27 Dec 2024 06:43:55 +0530	[thread overview]
Message-ID: <86cyhekjvw.fsf@gmx.net> (raw)
In-Reply-To: <m34j3lqmxo.fsf@leonis4.robolove.meer.net> (Madhu's message of "Tue, 03 Dec 2024 12:21:15 +0530")

Madhu wrote:

> When trying to use term-keys <https://github.com/CyberShadow/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 <Key> s          : string(0x1b) string(0x1f) string(0x3e) string(0x68) string(0x1f) \n\
> ~Shift ~Ctrl ~Meta  Super ~Hyper ~Alt <Key> d          : string(0x1b) string(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
> ‘describe-prefix-bindings’, 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))
>  => (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?

--



      reply	other threads:[~2024-12-27  1:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-03  6:51 emacs term-keys, and describe-prefix-translations Madhu
2024-12-27  1:13 ` James Thomas [this message]

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86cyhekjvw.fsf@gmx.net \
    --to=jimjoe@gmx.net \
    --cc=help-gnu-emacs@gnu.org \
    /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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).