GNU bug report logs - #70596
30.0.50; key-translate returns error for key sequences with punctuation marks

Previous Next

Package: emacs;

Reported by: Alexander Prähauser <ahprae <at> protonmail.com>

Date: Fri, 26 Apr 2024 17:31:07 UTC

Severity: normal

Found in version 30.0.50

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: Alexander Prähauser <ahprae <at> protonmail.com>
Cc: 70596 <at> debbugs.gnu.org
Subject: bug#70596: 30.0.50; key-translate returns error for key sequences with punctuation marks
Date: Sat, 27 Apr 2024 22:51:33 -0400
> (key-translate "C-." "C-a")

`key-translate` works by modifying `keyboard-translate-table` which is
a table remapping *characters* and not *keys*.

IOW, `key-translate` is a misnomer.

> Ah, I see.  Then I guess you can close this report.  So is there no way
> to translate `C-.` into `C-g`?

There are different ways to "translate" keys, and they all work slightly
differently.  If you expect to be able to hit `C-.` (instead of `C-g`)
to interrupt a running command, then that's more delicate to do
(because such interruptions use a mechanism that doesn't go through
keymaps like normal commands do), but otherwise something like

    (define-key input-decode-map (kbd "C-.") (kbd "C-g"))

might do the trick.


        Stefan





This bug report was last modified 1 year and 21 days ago.

Previous Next


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