When kmprocess is called, it enters a character input loop calling kbin to
get single unechoed characters from the keyboard (note that you'll have to
figure out how to do single character input on your system and write a new
version of xlkbin.c to implement it). When a sequence of characters is found
that matches one of the sequences defined in a key function call, the
corresponding message is sent. Kmprocess tries to send the message to each
of the objects in the environment list. It stops when it finds an object
that knows how to answer the message. Along with the message selector given
in the key definition, kmprocess also sends the sequence of characters that
matched as a single string parameter.

I got this idea from emacs, but thought that it might be interesting to
implement it in a more general way to allow for experimenting with uses
other than text editors. I have used it to implement a form processing
system at DEC, but that code is proprietary.