User manual

Chapter 4: Interacting with the ESS process 27
whenever the cursor is within a command line in the transcript (if the cursor is within some
command output, an error is signalled). Note all three commands involve the RETURN
key.
RET inferior-ess-send-input See Section 4.1 [Command-line editing], page 25.
C-c RET comint-copy-old-input Copy the command under the cursor to the current
command line, but don’t execute it. Leaves the cursor on the command line so
that the copied command may be edited.
When the cursor is not after the current prompt, the RETURN key has a slightly different
behavior than usual. Pressing RET on any line containing a command that you entered (i.e.
a line beginning with a prompt) sends that command to the ESS process once again. If you
wish to edit the command before executing it, use C-c RET instead; it copies the command
to the current prompt but does not execute it, allowing you to edit it before submitting it.
These commands work even if the current line is a continuation line (i.e. the prompt
is + instead of >’) in this case all the lines that form the multi-line command are
concatenated together and the resulting command is sent to the ESS process (currently this
is the only way to resubmit a multi-line command to the ESS process in one go). If the
current line does not begin with a prompt, an error is signalled. This feature, coupled with
the command-based motion commands described above, could be used as a primitive history
mechanism. ESS provides a more sophisticated mechanism, however, which is described in
Section 4.3 [Command History], page 28.
4.2.4 Keeping a record of your S session
To keep a record of your S session in a disk file, use the Emacs command C-x C-w (write-
file) to attach a file to the ESS process buffer. The name of the process buffer will
(probably) change to the name of the file, but this is not a problem. You can still use S as
usual; just remember to save the file before you quit Emacs with C-x C-s. You can make
ESS prompt you for a filename in which to save the transcript every time you start S by
setting the variable ess-ask-about-transfile to t; See Section 3.5 [Customizing startup],
page 23. We recommend you save your transcripts with filenames that end in .St’. There
is a special mode (ESS transcript mode see Chapter 6 [Transcript Mode], page 36) for
editing transcript files which is automatically selected for files with this suffix.
S transcripts can get very large, so some judicious editing is appropriate if you are saving
it in a file. Use C-c C-o whenever a command produces excessively long output (printing
large arrays, for example). Delete erroneous commands (and the resulting error messages
or other output) by moving to the command (or its output) and typing M-h C-w. Also,
remember that C-c C-x (and other hot keys) may be used for commands whose output you
do not wish to appear in the transcript. These suggestions are appropriate even if you are
not saving your transcript to disk, since the larger the transcript, the more memory your
Emacs process will use on the host machine.
Finally, if you intend to produce S source code (suitable for using with source() or
inclusion in an S function) from a transcript, then the command ess-transcript-clean-
region may be of use. see Section 6.2 [Clean], page 36