Next: , Previous: , Up: Interacting With Lisp   [Contents][Index]


9.2 Typescripts

Both slave buffers and background buffers are typescripts. The typescript protocol allows other processes to do stream-oriented interaction in a Hemlock buffer similar to that of a terminal. When there is a typescript in a buffer, the Typescript minor mode is present. Some of the commands described in this section are also used by Eval mode (page eval-mode.)

Typescripts are simple to use. Hemlock inserts output from the process into the buffer. To give the process input, use normal editing to insert the input at the end of the buffer, and then type Return to confirm sending the input to the process.

Command: Confirm Typescript Input (bound to Return in Typescript mode)]
Hemlock Variable: Unwedge Interactive Input Confirm (initial value t)

This command sends text that has been inserted at the end of the current buffer to the process reading on the buffer’s typescript. Before sending the text, Hemlock moves the point to the end of the buffer and inserts a newline.

Input may be edited as much as is desired before it is confirmed; the result of editing input after it has been confirmed is unpredictable. For this reason, it is desirable to postpone confirming of input until it is actually complete. The Indent New Line command is often useful for inserting newlines without confirming the input.

If the process reading on the buffer’s typescript is not waiting for input, then the text is queued instead of being sent immediately. Any number of inputs may be typed ahead in this fashion. Hemlock makes sure that the inputs and outputs get interleaved correctly so that when all input has been read, the buffer looks the same as it would have if the input had not been typed ahead.

If the buffer’s point is before the start of the input area, then various actions can occur. When set, Unwedge Interactive Input Confirm causes Hemlock to ask the user if it should fix the input buffer which typically results in ignoring any current input and refreshing the input area at the end of the buffer. This also has the effect of throwing the slave Lisp to top level, which aborts any pending operations or queued input. This is the only way to be sure the user is cleanly set up again after messing up the input region. When this is nil, Hemlock simply beeps and tells the user in the Echo Area that the input area is invalid.

Command: Kill Interactive Input (bound to M-i in Typescript and Eval modes)

This command kills any input that would have been confirmed by Return.

Command: Next Interactive Input (bound to M-n in Typescript and Eval modes)]
Command: Previous Interactive Input (bound to M-p in Typescript and Eval modes)]
Command: Search Previous Interactive Input (bound to M-P in Typescript and Eval modes)
Hemlock Variable: Interactive History Length (initial value 10)
Hemlock Variable: Minimum Interactive Input Length (initial value 2)

Hemlock maintains a history of interactive inputs. Next Interactive Input and Previous Interactive Input step forward and backward in the history, inserting the current entry in the buffer. The prefix argument is used as a repeat count.

Search Previous Interactive Input searches backward through the interactive history using the current input as a search string. Consecutive invocations repeat the previous search.

Interactive History Length determines the number of entries with which Hemlock creates the buffer-specific histories. Hemlock only adds an input region to the history if its number of characters exceeds Minimum Interactive Input Length.

Command: Reenter Interactive Input (bound to C-Return in Typescript and Eval modes)]

This copies to the end of the buffer the form to the left of the buffer’s point. When the current region is active, this copies it instead. This is sometimes easier to use to get a previous input that is either so far back that it has fallen off the history or is visible and more readily yanked than gotten with successive invocations of the history commands.

Command: Interactive Beginning of Line (bound to C-a in Typescript and Eval modes)]

This command is identical to Beginning of Line unless there is no prefix argument and the point is on the same line as the start of the current input; then it moves to the beginning of the input. This is useful since it skips over any prompt which may be present.

Hemlock Variable: Input Wait Alarm (initial value :loud-message)
Hemlock Variable: Slave GC Alarm (initial value :message)

Input Wait Alarm determines what action to take when a slave Lisp goes into an input wait on a typescript that isn’t currently displayed in any window. Slave GC Alarm determines what action to take when a slave notifies that it is GC’ing.

The following are legal values:

:loud-message

Beep and display a message in the echo area indicating which buffer is waiting for input.

:message

Display a message, but don’t beep.

nil

Don’t do anything.

Command: Typescript Slave BREAK (bound to Typescript: H-b)
Command: Typescript Slave to Top Level (bound to Typescript: H-g)
Command: Typescript Slave Status (bound to Typescript: H-s)

Some typescripts have associated information which these commands access allowing Hemlock to control the process which uses the typescript.

Typescript Slave BREAK puts the current process in a break loop so that you can be debug it. This is similar in effect to an interrupt signal (^C or ^\ in the editor process).

Typescript Slave to Top Level causes the current process to throw to the top-level read-eval-print loop. This is similar in effect to a quit signal (^\).

Typescript Slave Status causes the current process to print status information on error-output:

; Used 0:06:03, 3851 faults.  In: SYSTEM:SERVE-EVENT

The message displays the process run-time, the total number of page faults and the name of the currently running function. This command is useful for determining whether the slave is in an infinite loop, waiting for input, or whatever.


Next: The Current Package, Previous: Eval Servers, Up: Interacting With Lisp   [Contents][Index]