GNU bug report logs - #59130
Inconsistent behaviour with key-translation-map

Previous Next

Package: emacs;

Reported by: João Guerra <joca.bt <at> gmail.com>

Date: Tue, 8 Nov 2022 19:39:02 UTC

Severity: normal

Tags: notabug

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 59130 <at> debbugs.gnu.org, João Guerra <joca.bt <at> gmail.com>
Subject: bug#59130: Inconsistent behaviour with key-translation-map
Date: Tue, 08 Nov 2022 16:41:59 -0500
>> However, setting
>> (define-key key-translation-map (kbd "<apps>") (kbd "C-x @ h"))
>> and pressing <apps> p will not execute H-p.
>> 
>> (C-x @ h adds prefix hyper
>> https://www.gnu.org/software/emacs/manual/html_node/emacs/Modifier-Keys.html)
>> 
>> Is this an issue or as expected?

It's expected because the remapping of `C-x @ h` to a hyper prefix is
done with:

    (define-key function-key-map [?\C-x ?@ ?h] 'event-apply-hyper-modifier)

and `function-key-map` is applied *before* `key-translation-map` and hence
doesn't apply to the result of `key-translation-map` remapping.

    (define-key input-decode-map (kbd "<apps>") (kbd "C-x @ h"))

might work, OTOH, since `input-decode-map` applies before those
other two.

Note that `event-apply-hyper-modifier` has various limitations
(e.g. you can't use `?\C-x ?@ ?h ?\C-x ?@ ?m a` to make a `H-M-a` event)
so even if the above works it may not satisfy all your use cases.


        Stefan





This bug report was last modified 2 years and 252 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.