Personal tools
You are here: Home Projects LISP XLISP XLISP 0.0 Sources unpacked Keymap documentation
Document Actions

Keymap documentation

by Paul McJones last modified 2011-01-24 13:33


A keymap is data structure that translates a sequence of keystrokes into
a message.

In order to create a keymap:

(setq km (keymap))

In order to add a key definition to a keymap (km):

(key km "\eA" 'up)
(key km "\eB" 'down)
(key km "\eC" 'right)
(key km "\eD" 'left)

In order to invoke a keymap:

(setq env (list ob1 ob2 ob3 ob4))
(kmprocess km env)

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.

« December 2016 »
Su Mo Tu We Th Fr Sa
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31

Powered by Plone CMS, the Open Source Content Management System

This site conforms to the following standards: