User manual
Chapter 6: Manipulating saved transcript files 36
6 Manipulating saved transcript files
Inferior S mode records the transcript (the list of all commands executed, and their output)
in the process buffer, which can be saved as a transcript file, which should normally have the
suffix ‘.St’. The most obvious use for a transcript file is as a static record of the actions you
have performed in a particular S session. Sometimes, however, you may wish to re-execute
commands recorded in the transcript file by submitting them to a running ESS process.
This is what Transcript Mode is for.
If you load file a with the suffix ‘.St’ into Emacs, it is placed in S Transcript Mode.
Transcript Mode is similar to Inferior S mode (see Chapter 4 [Entering commands], page 25):
paragraphs are defined as a command and its output, and you can move though commands
either with the paragraph commands or with C-c C-p and C-c C-n.
6.1 Resubmitting commands from the transcript file
Three commands are provided to re-submit command lines from the transcript file to a
running ESS process. They are:
[Command]ess-transcript-send-command
M-RET Sends the current command line to the ESS process, and execute it.
[Command]ess-transcript-copy-command
C-c RET Copy the current command to the ESS process, and switch to it (ready to
edit the copied command).
[Command]ess-transcript-send-command-and-move
RET Sends the current command to the ESS process, and move to the next command
line. This command is useful for submitting a series of commands.
Note that the first two commands are similar to those on the same keys in inferior S Mode.
In all three cases, the commands should be executed when the cursor is on a command line
in the transcript; the prompt is automatically removed before the command is submitted.
6.2 Cleaning transcript files
Yet another use for transcript files is to extract the command lines for inclusion in an S
source file or function. Transcript mode provides one command which does just this:
[Command]ess-transcript-clean-region beg end even-if-read-only
C-c C-w Strip the transcript in the region (given by beg and end), leaving only com-
mands. Deletes any lines not beginning with a prompt, and then removes the prompt
from those lines that remain. Prefix argument even-if-read-only means to clean even
if the buffer is read-only. Don’t forget to remove any erroneous commands first!
The remaining command lines may then be copied to a source file or edit buffer for inclusion
in a function definition, or may be evaluated directly (see Chapter 5 [Evaluating code],
page 34) using the code evaluation commands from S mode, also available in S Transcript
Mode.










