When you ask ESS to evaluate the following from a buffer (C-c, C-b, or similar)
par(ask=TRUE)
plot(1,1)
plot(2,1)
The interpreter goes into a infinite loop beca开发者_如何学Cuse ESS starts the R session with the argument --no-readline. The loop can be broken with C-g, but is there any way to get the interpreter to actually request user input?
A solution is to edit ess-r-d.el
and remove the hard-coded --no-runtime
option given to R
, it is line 127 of the latest implementation.
Change
(let* ((r-always-arg
(if (or ess-microsoft-p (eq system-type 'cygwin))
"--ess "
"--no-readline "))
to
(let* ((r-always-arg
(if (or ess-microsoft-p (eq system-type 'cygwin))
"--ess "))
If there is a compiled version, you have to compile the .el
to generate and replace the binary .elc
file.
The file may be (the location of the directory depends on your OS)
in the
site-lisp
directory. Edit the.el
file in emacs (^X^F) then doM-x byte-compile-file
to generate the.elc
.if you installed from the whole zip/tar source package, in the
lisp
directory. In this case, after the change, perform amake
followed with amake install
.
You need of course to have write
access to the .el
and .elc
files.
If you do not feel comfortable with the compilation of the .el
file, you may simply remove it (.elc
) and use only the .el
version (should be only a slight performance difference).
(Strategies gathered from Google and RSiteSearches):
Do you see the prompt : "hit Return" in any of your session windows? If so ... hit .
If not, then try clicking in the plot window.
And if that fails, you should get control back with c-G.
Edit: A further strategy, admittedly not solving the ESS-non-interactivity problem: If you want to hold for user input, then readLines can be used:
input=file("stdin")
print(readLines(input,1))
精彩评论