| Allegro CL version 8.2 Minimally revised from 8.1. 8.1 version |
The Editor Workbook is a dialog showing one or more editor buffers. Each buffer may be open to a file, or may contain text data not yet saved to a file. Display the Editor Workbook with View | Editor. Open a new buffer with File | New. Open an existing text file with File | Open. Save with File | Save (you are prompted for a filename if the buffer is not already associated with a file). Close with File | Close Pane when the buffer to be closed is selected. Most of the commands on the IDE menu-bar are applicable in the editor, typically acting on the symbol or other "word" that the text cursor is on. The Edit menu is especially directed at the editor.
When saving a new IDE editor buffer for the first time, a yes-or-no dialog will first ask whether you want to add the new file to the current project. (This dialog will not appear if there is no current project, or for a form's editor buffer since that is already in the project.) If you answer yes, then the Save File dialog will default to the project's default directory, and the file will be added to the project. If you answer no, then the Save File dialog will default as it otherwise would, which is generally to the directory in which a file was last selected in this dialog, and the file will not be added to the current project.
Here is the Editor Workbook when Allegro CL and the IDE starts up, with one untitled buffer named Untitled. (If the Editor Workbook is not visible, it can be displayed with the View | Editor command.)
Editing in an editor buffer is mostly standard (type what you want and
characters appear at the cursor, selecting text and typing deletes the
selection, replacing it with what is typed, etc.) The behavior of key
chords (a modifier key, like Control or Alt pressed with one or more
character keys) depends on the current Comtab, which is specified on
the Editor
tab of the Options dialog. The predefined comtabs
are Host, Emacs, and Brief. Clicking Help | Shortcut Keys
displays a dialog showing the key
combinations, the function called by the key combination, and whether
the source of each keyboard shortcut is the IDE menu-bar, a global
keyboard shortcut, or the current editor comtab. See *text-edit-comtab*
to find out
how to add your own key bindings to the IDE editor's comtab (command
table).
Useful shortcut for copying Lisp expressions. (This particular
shortcut is not listed in the Help | Shortcut Keys
dialog because it does not involve a keystroke.) If you hold down the
Control key and left-click in the editor, the lisp expression at the
clicked position will be copied to the current text cursor position.
This is most useful when you are typing in new code and are about to
re-type something that is visible elsewhere in the editor buffer: in
this case you can simply click on the expression to copy it to the
point where you are entering code. To copy a form, click just before
the opening parenthesis of the form (or just after the closing
parenthesis if there is no opening parenthesis at the same character
position). To copy a string, click just before the opening
double-quote character. Otherwise the word that is at or near the
clicked position will be copied; this may be a symbol, or simply a set
of characters that could be read as a symbol. If the Shift Key
is held down along with the Control key, then the text is moved rather
than copied. These keystrokes are features of the lisp-edit-pane
and multi-line-lisp-text
classes, which may be used
in applications.
This shortcut does not appear in the Shortcuts dialog because it involves a mouse click and is thus not a key chord.
Two commands that are used frequently in the IDE Editor are the Tools | Incremental Compile command and the Tools | Incremental Evaluation command. The word "incremental" in these names means that you can compile or evaluate individual definitions or other expressions each time you modify your code incrementally.
The keyboard shortcuts for these commands (when the editor is in Host mode) are control-D and control-E. So typically each time you have just modified a defun form or other definition, you can quickly recompile that individual definition by first making sure that the text cursor is somewhere inside the definition, then typing control-D to compile it, and then perhaps retesting the code.
If instead you want to evaluate a top-level form, then you would type control-E instead -- the values returned by the evaluation will be printed to the listener in the Debug Window. If you are evaluating particular forms frequently, evaluating them in the editor (and saving them to a file) may be handier than re-entering them in the Debug Window or finding them in the Debug Window's command history.
When no text is selected, these commands are applied to the top-level form that the text cursor is currently inside or after. (A top-level form is simply one that begins with an open parenthesis in the leftmost column of the editor buffer.) Specifically, the command will be applied to a top-level form if the text cursor is either immediately before its opening parenthesis, or somewhere inside the form, or after the form but before the position immediately before the next top-level form (if any).
When any text is selected, these commands are applied directly to the selected text rather than to a top-level form. This is generally more useful for evaluation than for compilation. Text can be selected as usual by dragging the mouse with the left button down. In addition, a handy way to select a lisp form is to double-click immediately before the form's opening parenthesis. If multiple expressions are selected, then each one is compiled or evaluated in succession. You can even use the Edit | Select All command (control-A) to select all text and then compile or evaluate the entire editor buffer.
Another way to evaluate an expression in the editor is to place the text cursor just before the expression and then press the Enter key on the numeric keypad. (Or hold down the Alt key and press the main Enter key.) In addition to evaluating the expression, this also moves the text cursor just past the expression; this allows you to evaluate a sequence of expressions by pressing the numeric keypad's Enter key repeatedly. It is OK to repeat this keystroke quickly, because each successive evaluation will not be done until the previous one has returned. If the Control key is held down while pressing the numeric keypad's Enter key, or both Control and Alt are held down while pressing the main Enter key, then the form to be evaluated will first be copied to the listener as if it had been entered there at the prompt; this provides more context for reviewing the output in the listener.
The Tab key in all Comtab modes indents the current line appropriately for displaying Lisp text. Thus, if you have entered
(defun foo (x)
pressing Enter moves the cursor to the next line, adding spaces so the character typed is just under the `e' in `defun'. If you place the cursor at the beginning of the second line and press Tab, the cursor moves so the next character will be under the `e' in `defun' but no Tab character is input (instead, spaces are input as required). If you want an actual Tab character, press Shift-Tab.
If there is either an in-package
form (such as
(in-package :cg-user)
) as the first top-level form
in a buffer, the
package in the buffer will be the specified package as soon as Find
Package Specifier is chosen from the Editor's Shortcut Menu
(described below on this page) or any of the menubar commands File |
Save, Tools | Incremental Compile, or
Tools | Incremental Evaluation
are chosen.
The package of the buffer affects symbol completion and whether symbols need to be package-qualified in order for the system to identify them (for purposes of listing arguments of functions, finding documentation pages, etc.)
Shortcut menus that appear when right-clicking in IDE windows. They generally offer commands that are already available on the IDE's menu-bar, but are considered particularly useful in the context where the shortcut menu was invoked (Cut and Paste are on the Editor's shortcut menu, for example, as well as on the Edit menu). However, the Editor's shortcut menu also contains a few useful commands that are not found elsewhere. the command are appropriate for the type of file being edited. Not all these commands appear on the menu for all files.
(in-package
...)
form in the selected editor pane
and sets the current package of the pane to be that package, so that
the symbols in source code will be read into the correct package.
Control+Shift+J
. This choice is on the menu in part
to remind you of the keyboard shortcut.
Control+Shift+K
. This choice is on the menu in part
to remind you of the keyboard shortcut.
Control+Shift+L
. This choice is on the
menu in part to remind you of the keyboard shortcut.
Control+Shift+,
. This choice is on the menu in part
to remind you of the keyboard shortcut.
Control+Shift+.
. This choice is on the menu in part
to remind you of the keyboard shortcut.
The last four commands are not particularly useful for selecting from the shortcut menu itself, since it would be easier simply to click on the desired editor pane's tab instead. They appear on the menu as a reminder of their handy keystroke equivalents. For example, pressing control-shift-comma in the editor (perhaps more easily remembered as control-left-angle-bracket) selects the editor pane to the immediate left of the currently selected pane; and pressing control-shift-J selects the most recently selected pane. All such keyboard shortcuts may be found on the dialog displayed by choosing Help | Shortcut Keys.
These commands are handy for selecting various editor panes without needing to take a hand off the keyboard while typing. They are related to the Show Second, Show Third, and Show Fourth commands on the View | Manage Windows submenu, though those menu-bar commands apply to top-level IDE windows while these shortcut menu commands apply to panes within a single top-level window. These commands are also available in the Debug Window.
When the IDE configuration option highlight-selected-editor-tab is true, the IDE editor will always highlight the tab of the currently-selected buffer. This option is initially true, as the otherwise visual indication of the currently selected tab is rather subtle.
Copyright (c) 1998-2016, Franz Inc. Oakland, CA., USA. All rights reserved.
This page has had minimal revisions compared to the 8.1 page.
Created 2016.6.21.
| Allegro CL version 8.2 Minimally revised from 8.1. 8.1 version |