Next Previous Up Top Contents Index

5 Advanced Features

5.1 Customizing default key bindings

The key sequences to which individual commands are bound can be changed, and key bindings can be set up for commands which are not, by default, bound to any key sequences. Interactive means of modifying key bindings are described in "Key bindings" on page 92.

This section describes the editor functionbind-key, which is used to establish bindings programmatically. If you want to alter your personal key bindings, put the modifying code in your.lispworks file.

The default key bindings can be found in the fileconfig/key-binds.lisp in the LispWorks library directory.

editor:bind-key

Function

editor:bind-key name key &optional kind 

Binds the command name to the key sequence or combination key. kind can take the value:global,:mode, or:buffer. The default is :global, as most key bindings are required to work throughout the editor.:buffer applies the binding only to a specified buffer.:mode applies the binding only to buffers in a specified major mode.
If this function is called interactively, you will be prompted as necessary for the kind of binding, the buffer or the major mode. Tab completion may be used at any stage.
Note that the functioneditor:bind-key is a programmatic version the editor commandBind Key.
The following examples, which are used to implement some existing key bindings, illustrate how key sequences can be specified usingbind-key.
(in-package 'editor)
(bind-key "Forward Character" #\control-\f)
(bind-key "Forward Word" #\meta-\f)
(bind-key "Save File" '#(#\control-\x #\control-\s))
(bind-key "Regexp Forward Search" #\meta-control-\s)
(bind-key "Complete Field" #\space :mode "Echo Area")
(bind-key "Backward Character" "left")
(bind-key "Forward Word" #("control-right"))

editor:bind-string-to-key

Function

editor:bind-string-to-key string key &optional kind 

Binds the text string string to the keyboard shortcut key without the need to create a macro explicitly. The kind option is as foreditor:bind-key.

LispWorks Editor User Guide - 15 Oct 1998

Next Previous Up Top Contents Index

Generated with Harlequin WebMaker