1

I've recenly started to convert my init.el to using use-package, and have so far not found any problems with that -- except that I can't get ESS to work for all languages.

I have installed the package ess from Melpa. If I don't mention this at all in the init file, normal ".r" files get opened with ess-mode (showing as up as ESS[S]) as major mode, so there seems to be some automatic configuration going on. ".Rnw" files, on the other hand, don't get opened in ESS. Additionally, I want to use julia-mode in ESS (which is supposed to work automatically; the julia-mode package is also installed). So I added the following:

(use-package ess
  :mode (("\\.[rR]\\'" . R-mode)
         ("\\.[rR]nw\\'" . Rnw-mode)
         ("\\.jl\\'" . julia-mode)))

However, this does not help anything. When opening a ".jl" file, there is no julia function available, as there should; and there's always a warning

File mode specification error: (error Autoloading failed to define function Rnw-mode)

So, how am I supposed to set that up? I see that in most documentations, ESS mode is compiled by hand and loaded by (require 'ess-site) -- does that make the difference?

I'm using Emacs 25.1.

1 Answer 1

3

The file associations should all be set up for you. It works for me on Emacs 25.1 with just the following in my init:

(use-package ess
  :init (require 'ess-site))

This will set the associations for R-mode, julia-mode and Rnw-mode. If that doesn't work for you, the most likely explanation is that something else in your configuration is causing the problem (ie., by changing the assocations with R-mode etc).

2
  • Works, great! I hadn't thought of using both use-package and require... Commented Jan 2, 2017 at 14:57
  • It can be a bit tricky getting the more complex packages like ESS loaded at the correct time in your init sequence!
    – Tyler
    Commented Jan 2, 2017 at 15:00

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.