1

I have installed emacs on windows 10 working ok so far. Installed R and ESS. Set system and user path to Rterm.exe as read in some forums. Restarted and opened a R file in emacs. Syntax coloring is Ok, emacs entered ESS-R-mode but I cannot evaluate R code.

Using C-c C-n to evaluate the current line / selection, gives me a message:

"Searching for program: No such file or directory, R"

M-x R prompt for starting project directory, but same message is shown.

Double checked system PATH and everything seems ok. Checked emacs variable "getenv" and path is properly set to Rterm.exe folder.

I can open a shell inside emacs and run R prompt with no issue.

any hint?

UPDATE: tried setting (inferior-R-program-name "C:/Users/joe/R/bin/x64/Rterm") and (inferior-ess-r-program "C:/Users/joe/R/bin/x64/Rterm.exe") to .emacs file and now emacs is stuck on blank screen after asking for R starting project directory. The only way to close it is Task Manager - kill process

Forge
  • 275
  • 2
  • 13
  • what does `(executable-find "R")` return? – Felipe Lema Jul 11 '18 at 15:06
  • How to execute such command? I've tried M-x but helm did not find such – Forge Jul 11 '18 at 17:02
  • open the scratch buffer using `C-x b`, write down `(executable-find "R")`, go to end of line and type `C-x C-e` – Felipe Lema Jul 11 '18 at 18:45
  • answer is nil. Seems that some other variable needs to be set – Forge Jul 12 '18 at 07:00
  • tried setting (inferior-R-program-name "C:/Users/joe/R/bin/x64/Rterm") and (inferior-ess-r-program "C:/Users/joe/R/bin/x64/Rterm.exe") to .emacs file and now emacs is stuck on blank screen after asking for R starting project directory. The only way to close it is Task Manager - kill process – Forge Jul 12 '18 at 08:49
  • It seems that asking for R starting project directory is expected behaviour: http://ess.r-project.org/Manual/ess.html#Starting-up ... Here's a sample file, but it doesn't look like anything different http://members.cbio.mines-paristech.fr/~thocking/primer.html#sec-2.2 ... you might need to take it up to the developers here: https://github.com/emacs-ess/ESS/issues – Felipe Lema Jul 12 '18 at 20:58
  • Can you run R outside of Emacs? Can you show us your .emacs? – Tyler Dec 14 '18 at 14:51
  • Have the same problem - there has been a "init.el" file to say Emacs where the Rterm.exe is. However cannot find it in the recent ESS Emacs distribution (Windows). Can anybody advise where to put the pat to Rterm.exe? Many thanks! Zdenek – Zdenek Skala Dec 14 '18 at 10:36

2 Answers2

3

It's no longer required to use Rterm.exe; you can just use R.exe directly. To configure the program name that emacs/ESS uses, set the variable in your .emacs like this:

(setq inferior-ess-r-program "R")

Alternatively, press C-h v, select the inferior-ess-r-program variable, and use the Customize interface to set and save the setting.

If you don't have the Windows Path set correctly to include the R/bin folder, you can specify the full path in the setting.

(setq inferior-ess-r-program "C:/Program Files/R/R-3.5.3/bin/R.exe")
axiomatic
  • 41
  • 5
0

If (executable-find "R") returns nil, you can add the R location to exec-path through Customize. On my system, C:\Program Files\R\R-4.1.1\bin\x64. This will resolve the issue.

The easiest way to do this is to C-h v exec-path and then click through the "customize" option link. (Note that exec-path is both a variable and a function, and you want the variable.)

naugiedoggie
  • 334
  • 1
  • 8