A key sequence is just one possible form of a command.
So you can just use the following form (if I understand your question right):
(global-set-key (kbd "C-t") (kbd "<backspace>"))
You can replace backspace with C-t by translating it in input-decode-map
:
(define-key input-decode-map (kbd "C-t") (kbd "<backspace>"))
(define-key input-decode-map (kbd "<backspace>") [7])
The second form replaces backspace with the ASCII bell character. The harmless keyboard-quit
command is bound to that character.
Note that there is already a duplicate of this question but the following statement in that question is wrong:
I also tried this:
(global-set-key (kbd "\C-d") (kbd "<DEL>"))
But it obviously turns every C-d key into , so keybindings such C-c C-d stop working, making this not a suitable solution either.
See also the corresponding comment of VanLaser:
You say "it obviously turns every C-d key into , so keybindings such as C-c C-d stop working" - are you sure about that? When you press C-c (or C-x, or C-h) another keymap becomes active, in which C-d should NOT be overwritten. As per this doc: https://gnu.org/software/emacs/manual/html_node/elisp/Prefix-Keys.html
<backspace>
to'ignore
and mapC-t
to whatever<backspace>
was mapped to. – Tohiko Mar 05 '20 at 14:35C-h i g (elisp)Remapping Commands
– phils Mar 05 '20 at 17:51delete-backward-char
command since depending on the major mode many other commands are bound to theDEL
key. – Tobias Mar 05 '20 at 18:03