4

I have switched to using emacs-ess for my R code development and it is working great. I would like to be able to write some small R code I am using for debugging my R script into the scratch buffer, and be able to execute the scratch buffer code in the R process buffer. I've found how I could change the scratch buffer's mode to text by putting the following in the .emacs file:

(setq initial-major-mode 'text-mode)

Is there a similar statement I can put in my .emacs file that would make the scratch buffer have the ess-mode? I tried the following which results in an error about wrong type argument:

(setq initial-major-mode 'ess-mode)
sheed03
  • 197
  • 2
  • 8
  • Are you running the R interpreter? If I understand your question correctly, you want to create R scripts in the scratch buffer and then run them from the interpreter? – aduric Apr 14 '10 at 20:25
  • Hi aduric, that is pretty much the idea. I would have three buffers open during the session: The r-script file that contains all of my working code, the scratch buffer, and the R interpreter. So I would put R code in the scratch buffer, and then be able to execute it in the R interpreter. Of course I could just create a new file called scratch.R and then it would have the ess-mode, I was just hoping there was a way to make the *scratch* buffer have the same functionality out of the box so to speak. – sheed03 Apr 14 '10 at 20:41

1 Answers1

8

What you want is (setq initial-major-mode 'R-mode). Alternatively, you could just do M-x R-mode when in the scratch buffer to change the major mode.

Leo Alekseyev
  • 12,893
  • 5
  • 44
  • 44