[Top][All Lists]

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

Re: translating numpad keys in linux terminal

From: Simon Clubley
Subject: Re: translating numpad keys in linux terminal
Date: Thu, 2 Apr 2015 10:49:09 +0000 (UTC)
User-agent: slrn/0.9.9p1 (Linux)

On 2015-03-30, Tim Johnson <address@hidden> wrote:
> With emacs 24 on linux ubuntu 14.04 
> Gui emacs translates all numeric keypad keys except the backspace as
> distinct from the equivalent on the main keyboard.
> Example : kp-up vs. up
> Unfortunately, my preference is emacs -nw from the terminal, which
> in this case is gnome-terminal. emacs -nw only translates 
> kp-(divide, multiply, minus, plus and enter).
> Is there a way to read the other keys with "kp-" as in gui emacs?

Yes. (I currently rely on this ability for some of my workflow as
I use the EDT keypad layout when editing in emacs.)

You need a decent terminal emulator which supports DEC keyboard
escape sequences correctly and can go into application keypad mode.
For me, xterm with a script[*] I picked up from comp.os.vms a decade
or so qualifies as does the pterm component of PuTTY.

In both cases, I am running the keyboard permanently in application
keypad mode, rather than messing around with going in and out of
application keypad mode when entering/exiting emacs. This may not be
suitable for you and you may choose to do the switching yourself
as required.

You then have two choices:

1) You can look at a version of tpu-edt.el from early emacs 22.x or
before which shows how to turn the incoming escape sequences into
something can be processed within your emacs code.

2) Sometime after this, tpu-edt.el was rewritten to drop the direct
processing of escape sequences (and utterly breaking character cell
support in the process; I've only just discovered this after switching
to a newer LTS version of Linux and I've just notified the tpu-edt.el

However, even in this broken version, when TERM is set to vt200, the
keypad keys other than PF1-PF4 still work when in application keypad
mode, so this might be enough for you. If so, have a look at a current
version of tpu-edt.el and you might be able to see something which you
can use; this would appear to be an easier approach than directly
processing escape sequences in your case.


[*] There's a script on
which might help you get started if you choose this approach; you want
one which maps Num Lock to PF1; these specific scripts I have not tested

Simon Clubley, address@hidden
Microsoft: Bringing you 1980s technology to a 21st century world

reply via email to

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