Subject: Re: bug#70596: 30.0.50; key-translate returns error for key sequences with punctuation marks

From: Stefan Monnier <[email-masked]>
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