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?!

cammil
  • 509
  • 3
  • 12
  • 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 03 '20 at 19:19

1 Answers1

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)
cammil
  • 509
  • 3
  • 12