all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* rebound C-m
@ 2013-06-13 10:49 Luca Ferrari
  2013-06-14  5:01 ` Kevin Rodgers
  0 siblings, 1 reply; 4+ messages in thread
From: Luca Ferrari @ 2013-06-13 10:49 UTC (permalink / raw)
  To: help-gnu-emacs

Hi all,
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.

Thanks,
Luca



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: rebound C-m
       [not found] <mailman.1540.1371120584.22516.help-gnu-emacs@gnu.org>
@ 2013-06-13 13:42 ` Emanuel Berg
  2013-06-13 15:22 ` Stefan Monnier
  1 sibling, 0 replies; 4+ messages in thread
From: Emanuel Berg @ 2013-06-13 13:42 UTC (permalink / raw)
  To: help-gnu-emacs

Luca Ferrari <fluca1978@infinito.it> writes:

> Hi all,
>
> 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.

Try:

control keycode 50 = U+010F 

in /etc/console-setup/remap.inc (50 = 'm', get with `showkey';
Unicode code handle to be used later).

then

lkeys () {
    sudo loadkeys --clearcompose --clearstrings \
        /etc/console-setup/remap.inc > /dev/null
}

in ~/.zshrc (or .bashrc, etc.)

and

loadkeys /etc/console-setup/remap.inc > /dev/null

in /etc/rc.local (so won't have to give superuser password - or
any equivalent file if this is Debian local).

Last

(defun init-shortcut-c-m-b ()
  "Call this with M-x, then see if it works.
`forward-char' is just for testing.
The Unicode code is just a handle."
  (interactive)
  (define-key input-decode-map [?\u010F] [control meta])
  (local-set-key (kbd "<control> <meta> b") 'forward-char) )

in .emacs -

It works for me in a Linux tty, but I might have forgot to mention
something. There is another guy here who can give you a better
answer.

> Thanks,
> Luca

My pleasure,
Chrono

-- 
Emanuel Berg - programmer (hire me! CV below)
computer projects: http://user.it.uu.se/~embe8573
internet activity: http://home.student.uu.se/embe8573


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: rebound C-m
       [not found] <mailman.1540.1371120584.22516.help-gnu-emacs@gnu.org>
  2013-06-13 13:42 ` rebound C-m Emanuel Berg
@ 2013-06-13 15:22 ` Stefan Monnier
  1 sibling, 0 replies; 4+ messages in thread
From: Stefan Monnier @ 2013-06-13 15:22 UTC (permalink / raw)
  To: help-gnu-emacs

> 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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: rebound C-m
  2013-06-13 10:49 Luca Ferrari
@ 2013-06-14  5:01 ` Kevin Rodgers
  0 siblings, 0 replies; 4+ messages in thread
From: Kevin Rodgers @ 2013-06-14  5:01 UTC (permalink / raw)
  To: help-gnu-emacs

On 6/13/13 4:49 AM, Luca Ferrari wrote:
> Hi all,
> 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.

I don't know why C-m's default binding makes it necessary to undo that binding,
but this works for me:

(define-prefix-command 'my-return)
(global-set-key "\C-m" 'my-return)
(global-set-key "\C-mg" 'foo-bar)

-- 
Kevin Rodgers
Denver, Colorado, USA




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-06-14  5:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.1540.1371120584.22516.help-gnu-emacs@gnu.org>
2013-06-13 13:42 ` rebound C-m Emanuel Berg
2013-06-13 15:22 ` Stefan Monnier
2013-06-13 10:49 Luca Ferrari
2013-06-14  5:01 ` Kevin Rodgers

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.