unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Simon Clubley <clubley@remove_me.eisner.decus.org-Earth.UFP>
To: help-gnu-emacs@gnu.org
Subject: Re: translating numpad keys in linux terminal
Date: Fri, 3 Apr 2015 13:35:06 +0000 (UTC)	[thread overview]
Message-ID: <mfm4ua$23h$1@dont-email.me> (raw)
In-Reply-To: 87k2xu5doo.fsf@debian.uxu

On 2015-04-02, Emanuel Berg <embe8573@student.uu.se> wrote:
> Simon Clubley
><clubley@remove_me.eisner.decus.org-Earth.UFP> writes:
>
>> ... tpu-edt.el ... 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. ...
>
> What? :)
>

I promise you that explanation would make perfect sense to someone
with a DEC background who had actually used the physical terminals
the various emulators emulate (with various degrees of accuracy). :-)

> Please explain in more detail what to do step by step.
>

Other postings have covered most of this. However, a bit of background
on DEC terminals because I can see why you might be confused by what
I said.

On a DEC terminal, the top row of the keypad sends out escape sequences
when the keys on that row are pressed. The keys are known as PF1 (which
is the Num Lock position on a PC keyboard) through PF4 (the minus key).
PF1 is also known as the Gold key in the DEC world and you can see it
described as such in tpu-edt.el.

The rest of the keypad can operate in one of two modes, a numeric keypad
mode and an application keypad mode. You can switch the terminal between
these two modes by sending escape sequences to the terminal from a program.

In numeric mode, pressing (say) the 5 key, sends a 5. In application keypad
mode, pressing a key sends a specific and unique escape sequence.
Applications in the DEC world (such as editors) use this to determine the
user pressed a key on the keypad instead of on the main keyboard.

> If I set TERM to vt200 ('TERM=vt200 emacs -nw' in
> xterm), my colors are broken. Tho I am able to
> (require 'tpu-edt) that doesn't do anything to change
> the keys reported by `describe-key' what I can see.
>
> But yes, X and xterm should be enough because as said,
> xev do reports different keys when run from xterm.
>

As someone else mentioned, the different keycodes are required, but not
sufficient. When emacs is in character cell mode (emacs -nw) the only
thing it can see are the escape sequences coming from the terminal
emulator; it has no knowledge of what is going on at X11 level.

Either the terminal emulator already knows it needs to send these escape
sequences in response to a key press or it needs to be configured to do
so via some keycode to escape sequence mapping.

Simon.

-- 
Simon Clubley, clubley@remove_me.eisner.decus.org-Earth.UFP
Microsoft: Bringing you 1980s technology to a 21st century world


  parent reply	other threads:[~2015-04-03 13:35 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.3029.1427728348.31049.help-gnu-emacs@gnu.org>
2015-04-01 23:46 ` translating numpad keys in linux terminal Dan Espen
2015-04-02 10:49 ` Simon Clubley
2015-04-02 23:10   ` Emanuel Berg
2015-04-02 23:45     ` Richard Wordingham
     [not found]     ` <mailman.3207.1428018356.31049.help-gnu-emacs@gnu.org>
2015-04-03  0:48       ` Emanuel Berg
2015-04-03  1:23         ` Emanuel Berg
2015-04-03  1:25         ` Dan Espen
2015-04-03  1:46           ` Emanuel Berg
2015-04-03  2:56             ` Tim Johnson
     [not found]             ` <mailman.3215.1428029828.31049.help-gnu-emacs@gnu.org>
2015-04-03  3:38               ` Dan Espen
2015-04-03 13:35     ` Simon Clubley [this message]
2015-04-05 23:39       ` Emanuel Berg
2015-03-30 15:12 Tim Johnson
2015-04-01 10:08 ` Michael Heerdegen
     [not found] ` <mailman.3119.1427882930.31049.help-gnu-emacs@gnu.org>
2015-04-01 14:33   ` Pascal J. Bourguignon
2015-04-01 15:37     ` Tim Johnson
     [not found]     ` <mailman.3140.1427902682.31049.help-gnu-emacs@gnu.org>
2015-04-01 16:28       ` Pascal J. Bourguignon
2015-04-01 18:57         ` Tim Johnson
2015-04-01 23:23     ` Emanuel Berg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='mfm4ua$23h$1@dont-email.me' \
    --to=clubley@remove_me.eisner.decus.org-earth.ufp \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).