emacs -nw keypad, tpu-edt.el, and C-h

Andy Koppe andy.koppe@gmail.com
Sat May 30 07:34:00 GMT 2009

>>> Actually, this holy war can be bypassed, without sacrificing Emacs
>>> correctly working on a console.  What the console should send for that
>>> is the <Backspace> function key.
>> Makes sense to me.  Andy, is there any reason all cygwin terminals shouldn't
>> do this (including mintty)?  This already happens under X, and users would
>> then have consistent behavior.
> What is the "<Backspace> function key", i.e. what character sequence
> does that correspond to?

I've had a look at the emacs source. The Windows console variant of
emacs uses low-level console I/O, namely the ReadConsoleInput()
function. This delivers a stream of so-called input events, rather
than a stream of characters like the high-level console functions.
Also see here for the distinction:


One type of input event is a key event, which tells you exactly what
key was pressed and which modifiers are down. Emacs translates that
directly into its internal keyboard representation such as
<Backspace>, thereby indeed bypassing the whole question of how keys
should be represented in a character stream.

Unix terminals are character devices though, sp terminal emulators
have to encode keyboard events as sequences of characters, as that's
what terminal applications expect to get. The terminal version of
emacs then translates those into its internal representation.

Now of course if emacs can translate low-level console I/O as it sees
fit, then the Cygwin DLL could also be able to translate Backspace
into ^? characters rather than ^H, in CYGWIN=tty mode anyway. So I had
a look at fhandler_console.cc. It already uses ReadConsoleInput(), so
mapping from VK_BACK to ^? might be fairly straightforward actually.

I guess Cygwin 1.7 will be the last chance for quite a while to make
such a change, so is this something that should be considered?  A bit
of googling tells me that Redhat Linux actually decided to follow the
Debian guidelines many years ago and used ^? ever since, apart from a
little wobble in Fedora Core 3.


Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

More information about the Cygwin mailing list