Next: , Previous: , Up: Hemlock’s Lisp Environment   [Contents][Index]


14.3 Hemlock Streams

It is possible to create streams which output to or get input from a buffer. This mechanism is quite powerful and permits easy interfacing of Hemlock to Lisp.

Function: make-hemlock-output-stream mark &optional buffered
Function: hemlock-output-stream-p object

make-hemlock-output-stream returns a stream that inserts at the permanent mark mark all output directed to it. Buffered controls whether the stream is buffered or not, and its valid values are the following keywords:

:none

No buffering is done. This is the default.

:line

The buffer is flushed whenever a newline is written or when it is explicitly done with force-output.

:full

The screen is only brought up to date when it is explicitly done with force-output

hemlock-output-stream-p returns t if object is a hemlock-output-stream object.

Function: make-hemlock-region-stream region
Function: hemlock-region-stream-p object

make-hemlock-region-stream returns a stream from which the text in region can be read. hemlock-region-stream-p returns t if object is a hemlock-region-stream object.

Macro: with-input-from-region (var region) {declaration}* {form}*]

While evaluating forms, binds var to a stream which returns input from region.

Macro: with-output-to-mark (var mark [buffered]) {declaration}* {form}*

During the evaluation of the forms, binds var to a stream which inserts output at the permanent mark. Buffered has the same meaning as for make-hemlock-output-stream.

Variable: random-typeout-buffers
Function: with-pop-up-display (var &key height name) {declaration}* {form}*

This macro executes forms in a context with var bound to a stream. Hemlock collects output to this stream and tries to pop up a display of the appropriate height containing all the output. When height is supplied, Hemlock creates the pop-up display immediately, forcing output on line breaks. The system saves the output in a buffer named name, which defaults to Random Typeout. When the window is the incorrect height, the display mechanism will scroll the window with more-style prompting. This is useful for displaying information of temporary interest.

When a buffer with name name already exists and was not previously created by with-pop-up-display, Hemlock signals an error.

random-typeout-buffers is an association list mapping random typeout buffers to the streams that operate on the buffers.


Next: Interface to the Error System, Previous: Keyboard Input, Up: Hemlock’s Lisp Environment   [Contents][Index]