User manual

Chapter 4: Interacting with the ESS process 26
Thus, for example, you may use C-x [ and C-x ] to move backward and forwards through
ESS sessions in a single ESS process buffer. For more information about page commands,
see Section “Pages” in The GNU Emacs Reference Manual.
4.2.1 Manipulating the output from the last command
Viewing the output of the command you have just entered is a common occurrence and
ESS provides a number of facilities for doing this. Whenever a command produces a longish
output, it is possible that the window will scroll, leaving the next prompt near the middle
of the window. The first part of the command output may have scrolled off the top of the
window, even though the entire output would fit in the window if the prompt were near the
bottom of the window. If this happens, you can use the following comint commands:
comint-show-maximum-output to move to the end of the buffer, and place cursor on
bottom line of window to make more of the last output visible. To make this happen
automatically for all inputs, set the variable comint-scroll-to-bottom-on-input to t or
’this. If the first part of the output is still not visible, use C-c C-r (comint-show-output),
which moves cursor to the previous command line and places it at the top of the window.
Finally, if you want to discard the last command output altogether, use C-c C-o (comint-
kill-output), which deletes everything from the last command to the current prompt. Use
this command judiciously to keep your transcript to a more manageable size.
4.2.2 Viewing older commands
If you want to view the output from more historic commands than the previous command,
commands are also provided to move backwards and forwards through previously entered
commands in the process buffer:
C-c C-p comint-previous-input Moves point to the preceding command in the process
buffer.
C-c C-n comint-next-input Moves point to the next command in the process buffer.
Note that these two commands are analogous to C-p and C-n but apply to command lines
rather than text lines. And just like C-p and C-n, passing a prefix argument to these com-
mands means to move to the ARG’th next (or previous) command. (These commands are
also discussed in Section “Shell History Copying” in The GNU Emacs Reference Manual.)
There are also two similar commands (not bound to any keys by default) which move
to preceding or succeeding commands, but which first prompt for a regular expression (see
Section “Syntax of Regular Expression” in The GNU Emacs Reference Manual), and then
moves to the next (previous) command matching the pattern.
comint-backward-matching-input regexp arg
comint-forward-matching-input regexp arg
Search backward (forward) through the transcript buffer for the arg’th previ-
ous (next) command matching regexp. arg is the prefix argument; regexp is
prompted for in the minibuffer.
4.2.3 Re-submitting commands from the transcript
When moving through the transcript, you may wish to re-execute some of the commands
you find there. ESS provides three commands to do this; these commands may be used