[ESS] ESS confused about newest R

Shreyas Ragavan @hrey@@ @end|ng |rom |@@tm@||@com
Thu Jun 30 01:12:43 CEST 2022

FWIW: I am new to using R on windows and don't have admin rights on this machine, and use R 3.5.1. I have realised in the last few weeks that there are apparently 'different ways to grapple with Emacs on Windows', like downloading GNU's binaries, or launching Emacs from git-bash (which has it's own version of MSYS2 binaries bundled), using originally MSYS2 and then there is WSL and perhaps even more ways :S. Though I cannot use WSL, but I *have* seen differing and weird behavior in Emacs depending on which method is used. I am using only Emacs 28.1 and installed ESS from MELPA only a few days back, so it should the latest.

Since the ESS manual indicates that ESS should pick up multiple versions of R in parallel folders : out of morbid curiosity, I decided to install R 4.2.1 in a parallel folder. I do Not see ESS picking up different versions of R on my Emacs. I had the same behavior for MSYS2 compiled Emacs 28.1 and the git-bash version. I also install R in custom locations.

I don't know much elisp, but I do see with C-h v that `ess-newest-R` is a variable, and it is recommended that you call `M-x ess-find-newest-R`, and the latter function is missing for me. Subsequently, `M-x run-ess-r-newest` errors out with a "Wrong type argument: stringp, nil", which explains why I cannot see multiple R versions. The fact that you can see multiple R versions probably indicates you run Emacs in a different way than I do. 

So I simply `(setq ess-newest-R "~/lol/R/4.2.1/bin/x64/R.exe")` and then `M-x run-ess-r-newest` worked for me pointing to the desired R version. This could be your temporary 'workaround', unless somebody can advise on the elisp fix, since there does seem to be some bug in these particular functions, possibly something to do with the regex for Windows machines (and cygwin is mentioned in the source). Note : this worked despite me having R 3.5.1 *before* R 4.2.1 in my environment PATH variable. Considering this workaround, it is almost just the same amount of work as setting the PATH! :P.

More information about the ESS-help mailing list