Subject: bug#75586: 31.0.50; Cannot bind <C-m> with keymap-global-set

From: Robert Pluim <[email-masked]>
Date: Thu, 16 Jan 2025 09:34:18 +0100

>>>>> On Wed, 15 Jan 2025 19:32:15 +0100, Manuel Uberti <[email-masked]> said:

    Manuel> On 15/01/25 18:56, Robert Pluim wrote:
    >> Itʼs not clear to me what youʼre trying to achieve, nor why you need
    >> to change `input-decode-map'. Does
    >> 
    >> (define-prefix-command 'mu-ctrl-m-map)
    >> (keymap-global-set "C-m" mu-ctrl-m-map)
    >> 
    >> not do the right thing?

    Manuel> I want C-m to be different from RET in order to use it a prefix for a
    Manuel> series of multiple-cursors key bindings. C-m is easy to remember when I
    Manuel> think of "m"ultiple-cursors, so to speak.

    Manuel> With you lines, C-m is still recognised as RET plus I lose the ability
    Manuel> to hit RET to create a new line.

C-m will always be RET. If you want "the return key" to do something
different from RET, then you can bind "<return>", eg:

(keymap-global-set "<return>" (lambda () (interactive) (message "return")))
(keymap-global-set "C-m" (lambda () (interactive) (message "Control-m")))

(although if the `input-decode-map' thing works for you, who am I to
deny it? 😸)

More importantly: which bit of the documentation can we improve so
that itʼs clear that "RET" is spelled "C-m" for the purposes of
`keymap-global-set'?

Robert
--