9.9 Manipulating the Editor Process
9.9.1 Editor Mode9.9.2 Eval Mode9.9.3 Error Handling
When developing Hemlock customizations, it is useful to be able to manipulate
the editor Lisp environment from Hemlock. [annotate]
| Editor Describe | (bound to Home t, C-_ t) | [Command] |
| |
This command prompts for an expression, and then evaluates and describes it
in the editor process.
[annotate] [annotate] |
| |
Call the room function in the editor process, displaying information
about allocated storage in a pop-up window.
[annotate] [annotate] |
| Editor Load File | | [Command] |
9.9.1 Editor Mode
When Editor mode is on, alternate versions of the Lisp interaction
commands are bound in place of the eval server based commands. These commands
manipulate the editor process instead of the current eval server. Turning on
editor mode in a buffer allows incremental development of code within the
running editor. [annotate]
| |
This command turns on Editor minor mode in the current buffer. If it is
already on, it is turned off. Editor mode may also be turned on using
the Mode file option (see page 3.3.3.)
[annotate] [annotate] |
| Editor Compile Defun | | [Command] |
| Editor Compile Region | | [Command] |
| Editor Evaluate Buffer | | [Command] |
| Editor Evaluate Defun | | [Command] |
| Editor Evaluate Region | | [Command] |
| Editor Macroexpand Expression | (bound to Editor: C-M) | [Command] |
| Editor Re-evaluate Defvar | | [Command] |
| Editor Describe Function Call | | [Command] |
| Editor Describe Symbol | | [Command] |
| |
These commands are similar to the standard commands, but modify or examine the
Lisp process that Hemlock is running in. Terminal I/O is done on the
initial window for the editor's Lisp process. Output is directed to a pop-up
window or the editor's window instead of to the background buffer.
[annotate] [annotate] |
| Editor Compile Buffer File | | [Command] |
| Editor Compile File | | [Command] |
| Editor Compile Group | | [Command] |
| |
In addition to compiling in the editor process, these commands differ from the
eval server versions in that they direct output to the the
Compiler Warnings buffer.
[annotate] [annotate] |
| Editor Evaluate Expression | | [Command] |
| |
This command prompts for an expression and evaluates it in the editor process.
The results of the evaluation are displayed in the echo area.
[annotate] [annotate] |
9.9.2 Eval Mode
Eval mode is a minor mode that simulates a read
eval print loop running within the editor process. Since Lisp
program development is usually done in a separate eval server process (see page
9.1), Eval mode is used primarily for debugging code
that must run in the editor process. Eval mode shares some commands with
Typescript mode: see section 9.2. [annotate]
Eval mode doesn't completely support terminal I/O: it binds
standard-output to a stream that inserts into the buffer and
standard-input to a stream that signals an error for all operations.
Hemlock cannot correctly support the interactive evaluation of forms that read
from the Eval interactive buffer. [annotate]
| Select Eval Buffer | | [Command] |
| |
This command changes to the Eval buffer, creating one if it doesn't
already exist. The Eval buffer is created with Lisp as the major
mode and Eval and Editor as minor modes.
[annotate] [annotate] |
| Confirm Eval Input | | [Command] |
| |
This command evaluates all the forms between the end of the last output and
the end of the buffer, inserting the results of their evaluation in the buffer.
This beeps if the form is incomplete. Use Linefeed to insert line
breaks in the middle of a form. [annotate] This command uses Unwedge Interactive Input Confirm in the same way
Confirm Interactive Input does.
[annotate] [annotate] |
| Abort Eval Input | | [Command] |
| |
This command moves the the end of the buffer and prompts, ignoring any
input already typed in.
[annotate] [annotate] |
9.9.3 Error Handling
When an error happens inside of Hemlock, Hemlock will trap the error and
display the error message in the echo area, possibly along with the
"Internal error:" prefix. If you want to debug the error, type ?.
This causes the prompt "Debug:" to appear in the echo area. The following
commands are recognized:
[annotate]
- d
- Enter a break-loop so that you can use the Lisp debugger.
Proceeding with "go" will reenter Hemlock and give the "Debug:"
prompt again. [annotate]
- e
- Display the original error message in a pop-up window. [annotate]
- b
- Show a stack backtrace in a pop-up window. [annotate]
- q, Escape
- Quit from this error to the nearest command loop. [annotate]
- r
- Display a list of the restart cases and prompt for the number of a
restart-case with which to continue. Restarting may result in prompting in
the window in which Lisp started.
[annotate]
Only errors within the editor process are handled in this way. Errors during
eval server operations are handled using normal terminal I/O on a typescript in
the eval server's slave buffer or background buffer (see page
9.1.4). Errors due to interaction in a slave buffer will cause
the debugger to be entered in the slave buffer. [annotate]