0

I am trying to remap "C-m" but it seems to prevent from working. It actually seems to make the same as "C-m". I have no idea why.

I have tried this, which causes the problem: (bind-keys :map global-map ("C-m" . jump-char-backward) ("C-," . jump-char-forward))

And I tried this to fix it, which causes the problem that everywhere (for example on helm completion) now causes a new line:

(bind-keys :map global-map
       ("C-m" . jump-char-backward)
       ("C-," . jump-char-forward)
       ("<return>" . newline))

How can I fix this? And what mistakes have I made understanding how remapping keys work?!

1
  • Yes it does! As for a noob like me, how it did wasn't completely obvious, so I'll answer this question myself in case it helps others.
    – cammil
    May 3 '20 at 19:19
0

As kindly pointed out, this question explains it: C-m and are equivalent in ASCII so we need to first amend how emacs interprets the key sequence C-m. So this should work:

(define-key input-decode-map [?\C-m] [C-m])
(global-set-key (kbd "<C-m>") 'jump-char-backward)

Not the answer you're looking for? Browse other questions tagged or ask your own question.