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?

1 Answer 1

2

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)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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