help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: rebound C-m


From: Stefan Monnier
Subject: Re: rebound C-m
Date: Thu, 13 Jun 2013 11:22:30 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

> is it possible to rebind C-m (RET)? Because I've tried to assign a
> global key sequence "C-m g" but I got an error saying that I cannot
> bind RET, and hence the doubt.

On a tty, hitting the "return" key typically sends the same
byte-sequence (a single byte, actually) as when you hit C-m.
So, without extra configuration of your terminal emulator (and of
Emacs), you can't distinguish the two keys when running in text mode.

Under a GUI, the return key sends a `return' event, which is turned into
a ?C-m by function-key-map (i.e. only if there's no binding for the
`return' event).

If you don't care about running in a tty then you can do the following:

   (define-key input-decode-map [?\C-m] [C-m])

which will turn the event sent by the C-m key (originally a ?\C-m
character) into the C-m symbol.  Then you can bind anything you feel to
this new event:

   (global-set-key [C-m g] 'blabla).


        Stefan


reply via email to

[Prev in Thread] Current Thread [Next in Thread]