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

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

Re: C-<digit> key bindings not working on console


From: Emanuel Berg
Subject: Re: C-<digit> key bindings not working on console
Date: Thu, 23 Jan 2014 23:08:03 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Thorsten Jolitz <tjolitz@gmail.com> writes:

>> That's got nothing to do with Emacs: your
>> text-terminal is the culprit.  But don't worry: it's
>> not just your text-terminal, it's all(?) known
>> text-terminals.  Of course, you can configure your
>> text-terminal (e.g. Linux's console) to send a
>> different escape sequence for those chars, and then
>> tell Emacs to recognize those sequence.
>
> I once investigated how to do that kind of thing,
> unfortunately I forgot most of it by now and will
> have relearn it.

Linux console/VT/tty solution - tested on Debian.

I didn't figure out this myself, someone told me, just
as I tell someone, now. But because this question comes
now and then, it would be good to get feedback from the
OP, because then I can make adjustments and, if all
good and well, use this text next time around as
well. Use, reuse, and not reinventing the wheel,
remember? OK:

Put, in /etc/console-setup/remap.inc

control keycode 11 = U+0110

11 is 0, and you get that from 'showkey'. [If you use
tmux on top of the VT, use 'sudo showkey' (every time)
or 'chmod u+s /usr/bin/showkey' (once, then just
'showkey'). Find out where 'showkey' is with 'type' in
bash, and 'type' or 'where' in zsh.]

The Unicode (U+0110) is arbitrary in the sense it
doesn't matter what it is as long as it isn't in use
already, so make it exotic.

Then: 'sudo loadkeys /etc/console-setup/remap.inc'

Next, in an Emacs init file (.emacs, or if you want to
put such things somewhere else, and then `load-file'
from the main init file), in such a file, put:

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

Now, hit C-0 and it should say "<C-zero> is undefined",
which means you can bind it to whatever:

(global-set-key (kbd "<C-zero>") 'switch-buffer)

Note: Because you want to load the modified keymap when
booting the system, but without having to give the sudo
password, one way to do that on Debian is to put

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

in /etc/rc.local

-- 
underground experts united:
http://user.it.uu.se/~embe8573


reply via email to

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