Subject: Re: bug#65735: [PATCH] key-translate should use the 1st key of a key sequence

From: Shynur Xie <[email-masked]>
Date: Thu, 7 Sep 2023 13:42:18 +0000

> Robert:
> Perhaps we should also check that `from' and `to' specify single
> keys, although that might be overkill.

Not necessary IMO.
As a regular Emacs user, I would read its docstring before using this
function; the docstring already explains how to use it very clearly.
Moreover, there're several examples in the elisp manual for reference:

   +----------------------------------------------------+
   | -- Function: key-translate from to                 |
   |     ... ...                                        |
   |   Here’s an example of ...                         |
   |     (key-translate "C-x" "<control-x>")            |
   |     (keymap-global-set "<control-x>" 'kill-region) |
   +----------------------------------------------------+

> Robert:
> do you have a copyright assignment on file?

Yes.

> Robert:
> --- i/lisp/simple.el
> +++ w/lisp/simple.el

> - (keyboard-translate ?\C-h ?\C-?)
> -	(keyboard-translate ?\C-? ?\C-d))
> -	(keyboard-translate ?\C-h ?\C-h)
> -	(keyboard-translate ?\C-? ?\C-?))))
> +	(key-translate "C-h" "DEL")
> +	(key-translate "DEL" "C-d"))
> +	(key-translate "C-h" "C-h")
> +	(key-translate "DEL" "DEL"))))

The docstring of `keyboard-translate' does suggest using
`key-translate'; similarly, `define-key' suggests using `keymap-set'.

FWIW, I noticed that there're also some `define-key' invocations in
the file "lisp/simple.el".