Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!seismo!uunet!pcrat!rick
From: rick@pcrat.UUCP (Rick Richardson)
Newsgroups: comp.sources.d
Subject: Re: when using emacs, get the keymap right!
Message-ID: <340@pcrat.UUCP>
Date: Wed, 24-Jun-87 19:21:29 EDT
Article-I.D.: pcrat.340
Posted: Wed Jun 24 19:21:29 1987
Date-Received: Fri, 26-Jun-87 06:01:51 EDT
References: <1283@cullvax.UUCP> <1183@osiris.UUCP> <5741@think.UUCP>
Organization: PC Research, Inc., Tinton Falls, NJ
Lines: 34
Summary: Escape sequences

In article <5741@think.UUCP>, barmar@think.uucp (Barry Margolin) writes:
> There's a big problem with having Emacs understand function/arrow keys
> ...
> However, I'm familiar with a family of terminals (Honeywell VIPs)
> which sent a different escape sequence for the arrow keys and 24
> function keys.  Some of the function keys even send ESC !  How
> are users supposed to deal with such incompatibilities between
> terminals?
The usual way is for the program to issue a read of N characters
(terminal type dependant) whenever an ESCAPE character has just been read.
If the TTY driver idle time is set to 1/10 second, then the return code of
this read will be:

	0)	User just typed an ESCAPE by itself.
	!0)	Function key was typed, buffer has rest of sequence

Then, you take the escape sequence you just got, and look it up in
terminfo against all of the definitions of key escape sequences which are
found in that database.  Unfortunately, the standard terminfo database
doesn't contain enough key sequences to adequately describe all of the
extra keys on some keyboards (such as PC's).  But it's a good start.

This procedure works very well, and I use it in UniTalk to diffentiate
Function and Meta keys which are interpreted locally by UniTalk from a
regular ESCAPE from the user which should be sent out the comm port.

Sadly, memacs seems to contain no such mechanism for UNIX.  In fact, it
appears that no attempt at isolating terminal dependant INPUT was made.
The terminal dependant output stuff is reasonably isolated (tcap.c, for
example).
-- 
	Rick Richardson, President, PC Research, Inc.
(201) 542-3734 (voice, nights)   OR   (201) 834-1378 (voice, days)
		seismo!uunet!pcrat!rick