0

I install ESS following these directions, adding these to ~/.emacs:

(require 'package)
(add-to-list 'package-archives
             '("melpa-stable" . "https://stable.melpa.org/packages/"))
(add-to-list 'package-archives
             '("melpa" . "http://melpa.org/packages/"))
(package-initialize)

then typing M-x package-install RET ess RET, and adding this to ~/.emacs as well:

(require 'ess-site)

Now when I open an R file in Emacs, I get this message in a buffer:

Warning (flymake): Disabling backend ess-r-flymake because (error Cannot find program ’R’)
Warning (flymake): Disabling backend flymake-proc-legacy-flymake because (error Can’t find a suitable init function)
Warning (flymake): Disabling backend ess-r-flymake because (error Cannot find program ’R’)
Warning (flymake): Disabling backend flymake-proc-legacy-flymake because (error Can’t find a suitable init function)

and typing in the buffer with the R file is slower because of warnings from Flymake.

I have also set the inferior R program as in this thread:

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

But the result is the same.

How can I fix this?

miguelmorin
  • 1,751
  • 11
  • 33
  • ESS seems not to find R. Have you read an tried the comments ftom the second thread that you link to? Is R working okay from the command line? – andrej Mar 22 '19 at 10:42
  • Yes, I read and tried those comments, which is why I added the `inferior-ess-r-program` command. R works OK from the command line and is at `/usr/local/bin/R `. – miguelmorin Mar 22 '19 at 11:42
  • what does (executable-find "R") return? In your case it should be /usr/local/bin/R – andrej Mar 22 '19 at 18:18
  • @andrej Yes, running `M-:` `(executable-find "R")` displays `"/usr/local/bin/R"` in the mini-buffer. – miguelmorin Mar 26 '19 at 08:28
  • 1
    Sorry! Then I don't know what to do. On my system ess-r-flymake isn't called when I open an R file. Would suggest asking on the ESS github page. – andrej Mar 29 '19 at 14:01
  • @andrej I'm at a loss as well, especially because the setup worked fine with ESS installed from source and appeared when I switched to ESS from MELPA. – miguelmorin Mar 30 '19 at 06:58
  • 1
    @andrej The problem has now disappeared and setting the inferior process was the answer, along with disabling legacy stuff from flymake, as I wrote [here](https://github.com/emacs-ess/ESS/issues/883). I don't know why Emacs behaved differently then compared to now. Do you want to write an answer? – miguelmorin May 13 '19 at 14:56
  • Noce! It's perfectly fine to answer your question yourself. I do think that you have a better answer that closes this question! – andrej May 13 '19 at 22:00

1 Answers1

2

R executable

I confirm that flymake can now find the R executable. The line (setq inferior-ess-r-program "/usr/local/bin/R") was the problem: without the line, I (executable-find "R") returns nil and I get this warning twice:

Warning (flymake): Disabling backend flymake-proc-legacy-flymake because (error Can’t find a suitable init function)

I added that line to my ~/.emacs on March 26, so I don't understand why the changes did not take effect 4 days after, even though I turn off the computer every day.

Disabling backend flymake-proc-legacy-flymake

Now I get only this message:

Warning (flymake): Disabling backend flymake-proc-legacy-flymake because (error Can’t find a suitable init function)
Warning (flymake): Disabling backend flymake-proc-legacy-flymake because (error Can’t find a suitable init function)

I found that I could disable the legacy stuff with

(remove-hook 'flymake-diagnostic-functions 'flymake-proc-legacy-flymake)

So, although the last one is quick-and-dirty, it works for me.

Cross-posted from Github issue.

miguelmorin
  • 1,751
  • 11
  • 33