User manual
Chapter 4: Interacting with the ESS process 29
(setq comint-scroll-to-bottom-on-output ’others)
(setq comint-scroll-show-maximum-output t)
;; somewhat extreme, almost disabling writing in *R*, *shell* buffers above prompt:
(setq comint-scroll-to-bottom-on-input ’this)
))
to your ‘.emacs’ file, where the last two settings are typically desirable for the situation
where you work with a script (e.g., ‘code.R’) and send code chunks to the process buffer
(e.g. *R*). Note however that these settings influence all comint-using emacs modes, not
just the ESS ones, and for that reason, these customization cannot be part of ESS itself.
4.3.1 Saving the command history
The ess-history-file variable, which is t by default, together with ess-history-
directory, governs if and where the command history is saved and restored between
sessions. By default, ess-history-directory is nil, and the command history will be
stored (as text file) in the ess-directory, e.g., as ‘.Rhistory’.
Experienced ESS users often work exclusively with script files rather than in a (e.g., *R)
console session, and may not want to save any history files, and hence have:
(setq ess-history-file nil)
or will only want one global command history file and have:
(setq ess-history-directory "~/.R/")
in your ‘.emacs’ file.
4.4 References to historical commands
Instead of searching through the command history using the command described in the pre-
vious section, you can alternatively refer to a historical command directly using a notation
very similar to that used in csh. History references are introduced by a ‘!’ or ‘^’ character
and have meanings as follows:
‘!!’ The immediately previous command
‘!-N ’ The Nth previous command
‘!text’ The last command beginning with the string ‘text’
‘!?text’ The last command containing the string ‘text’
In addition, you may follow the reference with a word designator to select particular
words of the input. A word is defined as a sequence of characters separated by whitespace.
(You can modify this definition by setting the value of comint-delimiter-argument-list
to a list of characters that are allowed to separate words and themselves form words.) Words
are numbered beginning with zero. The word designator usually begins with a ‘:’ (colon)
character; however it may be omitted if the word reference begins with a ‘^’, ‘$’, ‘*’ or
‘-’. If the word is to be selected from the previous command, the second ‘!’ character can
be omitted from the event specification. For instance, ‘!!:1’ and ‘!:1’ both refer to the
first word of the previous command, while ‘!!$’ and ‘!$’ both refer to the last word in the
previous command. The format of word designators is as follows:
‘0’ The zeroth word (i.e. the first one on the command line)










