All Manuals > LispWorks Editor User Guide > 6 Advanced Features


6.3 Programming the editor

The editor functions described in this section can be combined and provided with arguments to create new commands.

Existing editor commands can also be used in the creation of new commands. Every editor command documented in this manual is named by a string command which can be used to invoke the command interactively, but there is also associated with this a standard Lisp function (the "command function") named by a symbol exported from the editor package. You can use this symbol to call the command programmatically. For example, the editor command Forward Character is referred to by editor:forward-character-command .

The first argument of any command function is the prefix argument p , and this must therefore be included in any programmatic call, even if the prefix argument is ignored. Some commands have additional optional arguments. For example to insert 42 #\! characters, you would call

(editor:self-insert-command 42 #\!)

Details of these optional arguments are provided in the command descriptions throughout this manual.

See editor:defcommand for the details of how to create new commands.

Note: the code found in this chapter is included in the examples/editor directory in the LispWorks library.

Note: code which modifies the contents of a capi:editor-pane (for example a displayed editor buffer) must be run only in the interface process of that pane.

The following sections describe editor functions that are not interactive editor commands.

6.3.1 Calling editor functions

6.3.2 Defining commands

6.3.3 Buffers

6.3.4 Points

6.3.5 The echo area

6.3.6 Editor errors

6.3.7 Files

6.3.8 Inserting text

6.3.9 Indentation

6.3.10 Lisp

6.3.11 Movement

6.3.12 Prompting the user

6.3.13 In-place completion

6.3.14 Variables

6.3.15 Windows

6.3.16 Examples

LispWorks Editor User Guide (Windows version) - 3 May 2011