Capturing Lisp output


Here are different methods for capturing the results of an interactive session:

Lisp-specific way using DRIBBLE

You tell Lisp to send a copy of everything you type and everything the system types to the file output.text by calling the function

(dribble "output.text")

To stop recording the interactive session you call dribble without a filename

(dribble)

Lisp-specific way using a user defined function

Here are two examples of lisp functions or macros that write to a file:

Unix-specific way using script

You tell Unix to send a copy of everything you type and everything the system types to the file output.text by using the command

% script output.text

To stop recording a copy of the session you hit Control-D

% ^D

Since Unix traps all the characters, if you make any typing error the file will contain all the characters you typed, including backspace and corrections.

Emacs-specific way

The Lisp buffer, like all emacs buffers, can be saved to disk (Use C-x C-w to save it with a new name such as Output.text), edited, etc. So run your test cases, save the Lisp buffer, then if needed edit out any lines that were not test cases.

The views and opinions expressed in this page are strictly those of the page author.
The contents of this page have not been reviewed or approved by the University of Minnesota.