Previous Section | Next Chapter | Table of Contents | Glossary | Index |
This chapter is somewhat of a catch-all for comments and features that don't fit well anywhere else.
The canonical representation of editor input is a key-event structure. Users can bind commands to keys, which are non-empty sequences of key-events. A key-event consists of an identifying token known as a keysym and a field of bits representing modifiers. Users define keysyms by supplying names that reflect the legends on their keyboard's keys. Users define modifier names similarly, but the system chooses the bit and mask for recognizing the modifier. You can use keysym and modifier names to textually specify key-events and Hemlock keys in a #k syntax. The following are some examples:
#k"C-u" #k"Control-u" #k"c-m-z" #k"control-x meta-d" #k"a" #k"A" #k"Linefeed"
This is convenient for use within code and in init files containing bind-key calls.
The #k syntax is delimited by double quotes, but the system parses the contents rather than reading it as a Common Lisp string. Within the double quotes, spaces separate multiple key-events. A single key-event optionally starts with modifier names terminated by hyphens. Modifier names are alphabetic sequences of characters which the system uses case-insensitively. Following modifiers is a keysym name, which is case-insensitive if it consists of multiple characters, but if the name consists of only a single character, then it is case-sensitive.
You can escape special characters --- hyphen, double quote, open angle bracket, close angle bracket, and space --- with a backslash, and you can specify a backslash by using two contiguously. You can use angle brackets to enclose a keysym name with many special characters in it. Between angle brackets appearing in a keysym name position, there are only two special characters, the closing angle bracket and backslash.
This function establishes a mapping from preferred-name to keysym for purposes of #k syntax. Other-names also map to keysym, but the system uses preferred-name when printing key-events. The names are case-insensitive simple-strings; however, if the string contains a single character, then it is used case-sensitively. Redefining a keysym or re-using names has undefined effects.
Keysym can be any object, but generally it is either an integer representing the window-system code for the event, or a keyword which allows the mapping of the keysym to its code to be defined separately.
This establishes long-name and short-name as modifier names for purposes of specifying key-events in #k syntax. The names are case-insensitive strings. If either name is already defined, this signals an error.
The system defines the following default modifiers (first the long name, then the short name):
"Hyper", "H"
"Super", "S"
"Meta", "M"
"Control", "C"
"Shift", "Shift"
"Lock", "Lock"
This function returns the character associated with key-event. You can associate a character with a key-event by setf'ing this form. The system defaultly translates key-events in some implementation dependent way for text insertion; for example, under an ASCII system, the key-event #k"C-h", as well as #k"backspace" would map to the Common Lisp character that causes a backspace.
Previous Section | Next Chapter | Table of Contents | Glossary | Index |