GNU bug report logs -
#65735
[PATCH] key-translate should use the 1st key of a key sequence
Previous Next
Reported by: Shynur Xie <one.last.kiss <at> outlook.com>
Date: Mon, 4 Sep 2023 15:52:02 UTC
Severity: normal
Tags: fixed, patch
Fixed in version 29.2
Done: Robert Pluim <rpluim <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
Message #20 received at 65735 <at> debbugs.gnu.org (full text, mbox):
> 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".
This bug report was last modified 1 year and 248 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.