1

I am trying to rebind kmacro-start-macro and kmacro-end-macro to C-m and C-S-m.
But I am having some issues because of C-m being equivalent to RET, the ASCII control character "carriage return".

In the answer to How to distinguish C-m from RETURN? question, shows how to make C-m binding work with:

(define-key input-decode-map [?\C-m] [C-m])
(global-set-key (kbd "<C-m>") 'kmacro-start-macro)

But I am not able to bind C-S-m. With:

(global-set-key (kbd "<C-S-m>") 'kmacro-end-macro)

Whenever I use describe-key on C-S-m, it shows:

RET (translated from S-RET) runs the command newline (found in
global-map), which is an interactive compiled Lisp function in
‘simple.el’.

It is bound to RET.

How can I bind C-S-m?

Drew
  • 75,699
  • 9
  • 109
  • 225
nephewtom
  • 2,219
  • 17
  • 29

1 Answers1

3

While writing the answer and doing some tests, I found how to bind C-S-m in a similar fashion as C-m, escaping Shift key with \S.

These lines made it work:

(define-key input-decode-map [?\C-\S-m] [C-S-m])
(global-set-key (kbd "<C-S-m>") 'kmacro-end-macro)
nephewtom
  • 2,219
  • 17
  • 29