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

8
  • what does (executable-find "R") return? Commented Jul 11, 2018 at 15:06
  • How to execute such command? I've tried M-x but helm did not find such
    – Forge
    Commented Jul 11, 2018 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 Commented Jul 11, 2018 at 18:45
  • answer is nil. Seems that some other variable needs to be set
    – Forge
    Commented Jul 12, 2018 at 7: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
    Commented Jul 12, 2018 at 8:49

2 Answers 2

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")
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.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.