[R] ESS+R not closing gracefully

Damon Wischik djw1005 at cam.ac.uk
Sun Mar 2 19:34:03 CET 2003

I am having trouble with ESS+R. I don't know if it is an ESS
problem or an R problem, so I'm posting to this mailing list in
the first instance.

I am using R 1.6.2, Windows XP (latest updates installed), XEmacs 21.4,
and ESS 5.1.21. I have experienced the same problem under Windows 2000 and
recent versions of Emacs and ESS (though my current Windows XP
installation is from scratch, and I've lost details of my old

I start up XEmacs. I press M-R to start an R session. I straightaway do

> quit()

and it quits cleanly.

Now I try something else. I start up XEmacs. I press M-R to start an R
session. I do

> hist(rnorm(10))
> dev.off()
null device
> quit()
Save workspace image? [y/n/c]: n

and then it fails to quit. The Windows task manager tells me that the
process Rterm.exe is taking up 95% or so of CPU time. If I forcibly quit
it, using the Windows task manager, I see in the XEmacs window:

Process R exited abnormally with code 1 at <time>.

(I can't see any reason why, even if there is a problem, Rterm should
seemingly loop endlessly; that is why I am posting to this mailing list in
the first instance.) 

If, from the Windows command prompt, I run rterm, and do 

> hist(rnorm(10))
> dev.off()
> quit()

it quits cleanly.

In case it is relevant, I have made one change to the ESS file
ess-site.el: I added

(setq-default inferior-R-program-name 
  "c:\\program files\\R\\bin\\Rterm.exe")

(since otherwise it couldn't find Rterm.exe, even though it is on my
path); also, my emacs init file init.el reads thus:

(load "c:/program files/xemacs/xemacs-packages/lisp/ess/ess-site")
(setq comint-scroll-to-bottom-on-output t)
(setq ess-ask-for-ess-directory nil)
(setq ess-pre-run-hook '((lambda () (setq S-directory
(setq ess-source-directory (expand-file-name "~/temp/"))
(global-set-key [(shift return)] 'ess-eval-paragraph)


More information about the R-help mailing list