This section deals with some of the most basic commands available in the Editor. It describes how to perform simple file management, how to move around a buffer, and tells you about some other more general commands available.
When you first start up the Editor, the first thing you must do is open a file.
Use file extensions .lisp
or .lsp
for Common Lisp files. The Editor recognizes these extensions and places the buffer in Lisp mode. Lisp mode provides special features for use in Lisp editing, as described in 12.13.1 Lisp mode.
You can create a new Lisp buffer by choosing File > New or clicking on . The new file is automatically in Lisp mode, and the buffer is called "Unnamed". When you try to save this buffer, the Editor prompts you for a filename.
As you have already seen, you can open an existing file by choosing File > Open... or clicking on . A dialog appears from which you can select a file to edit.
To save a file, choose File > Save or click on . If the file has not been saved before (that is, if you created the file by choosing File > New and this is the first time you have saved the file), you are prompted for a directory and a filename.
You can also save a file by using the keyboard command Ctrl+X Ctrl+S
.
If you want to make a copy of the file (save the file under a different name) choose File > Save As... and specify a name in the dialog that appears.
Choose File > Revert to Saved to revert back to the last saved version of the file. This replaces the contents of the current buffer with the version of that file which was last saved on disk. This command is useful if you make a number of experimental changes which you want to abandon.
As well as saving whole files to disk, you can save any part of a file to disk under a different filename. To do this:
Note that the selected text is copied into the new file, rather than moved; it is still available in the original buffer.
To find out more about selecting regions of text, see 12.11.1 Marking the region. To find out more about operating on regions of text, see 12.13 Using Lisp-specific commands.
To print the file in the current buffer to your default printer, choose File > Print.... The printer can be changed or configured by using the standard Windows Control Panel.
This section describes how you can move the cursor around the buffer. There are a variety of commands, allowing you to move sideways, up, or down by one character, or by a number of characters.
To move directly to any point in the buffer, position the pointer and click the left mouse button. If necessary, use the scroll bars to reveal sections of the buffer which are not visible in the window.
You can either use the arrow keys, or the keyboard commands shown below to move the cursor in any direction by one character.
Moving the cursor by one character
The keyboard commands below move to the beginning or end of the line, or the top or bottom of the buffer.
Keyboard commands for basic movement within an editor buffer
Press Ctrl+V
or the Page Down
key to scroll down one screenful of text.
Press Esc V
or Alt+V
or the Page Up
key to scroll up one screenful of text.
You should ensure that you learn the keyboard commands described above, since they make navigation in a buffer much easier.
The editor provides a sophisticated range of commands for cutting text which are described in 12.11 Cutting, copying and pasting using the kill ring. However, the two basic commands for deleting text which you should remember are as follows:
Backspace
key.Ctrl+D
or the Delete
key if available.
You can insert text into a buffer by typing characters, or by pasting (see 12.11 Cutting, copying and pasting using the kill ring) or by inserting the contents of a file.
By default, when typing in a buffer, any characters to the right of the cursor are moved further to the right. If you wish to overwrite these characters, rather than preserve them, press the Insert
key. To return to the default behavior, just press the Insert
key once more.
To insert the contents of one file into another, choose File > Insert.... A dialog appears so that you can choose a file to insert, and this is then inserted into the current buffer, starting from the current position of the cursor.
As mentioned above, you can have as many buffers open at once as you like. Repeated use of File > Open... or Ctrl+X Ctrl+F
just creates extra buffers.
Because the Editor can only display one buffer at a time, you can use either menu commands or keyboard commands to swap between buffers.
Each item in the History > Items submenu is an open buffer. To swap to a given buffer, choose it from the menu, and it is displayed in the editor window.
Alternatively, click on the Buffers tab to swap to the Buffers view; see 12.3 Displaying and swapping between buffers for details.
To use the keyboard, type Ctrl+X B
. You are prompted for the name of the buffer you wish to display. The last buffer you displayed is chosen by default, and is listed in the echo area in brackets, as shown below.
Select Buffer: (test.lisp):
To swap to the buffer shown in brackets, just press Return
. To swap to another buffer, type in the name of that buffer. Remember that completion (press Tab
) can help.
To close the buffer that is currently displayed, choose File > Close, or in Microsoft Windows editor emulation press Ctrl+W
, or type Ctrl+X K
.
Ctrl+X K
, you can close any buffer, not just the current one. Type a buffer name in the echo area, or press Return
to close the current buffer.
Note: If you attempt to close any buffer which you have changed but not yet saved, a dialog appears, giving you the opportunity to cancel the operation.
To save all the buffers in the Editor, choose File > Save All.... A dialog appears which lists each modified buffer. By default, each buffer is selected, indicating that it is to be saved. If there are any buffers that you do not want to save, deselect them by clicking on them. The dialog has four buttons, as follows:
This dialog is also displayed if there are any unsaved files when you exit the environment.
Sometimes you may find that being able to display only one buffer in the window simply does not give you enough flexibility. For instance, you may have several buffers open, and you may want to look at two different buffers at once. Or you may have a very large buffer, and want to look at the beginning and end of it at the same time.
You can do any of these by creating a new Editor window. Choose Tools > Clone or press Ctrl+X 2
or click the button. This creates a copy of your original Editor. The new Editor displays the same buffer as the original one.
Changes made to a buffer are automatically reflected across all editor windows - the buffer may be displayed in two different windows, but there is still only one buffer. This means that it is impossible to save two different versions of the same file on disk.
LispWorks IDE User Guide (Windows version) - 01 Dec 2021 19:37:58