1

When I am editing .Rmd file within a polymode chunk, the mode switches from ESS to Markdown mode whenever I press enter. However, it switches back to ess-mode whenver I save the file.

I will try to demonstrate this: C-hvmajor-modeEnter

major-mode is a variable defined in ‘C source code’.
Its value is ‘ess-r-mode’
Original value was fundamental-mode
Local in buffer hw5.Rmd[R]; global value is fundamental-mode
x <- runif(100)

I run this command with no problem but then I hit enter

```{r}
x <- runif(100)


```

C-hvmajor-modeEnter

major-mode is a variable defined in ‘C source code’.
Its value is ‘markdown-mode’
Original value was fundamental-mode
Local in buffer hw5.Rmd; global value is fundamental-mode

Obviously, I have now lost the ess functionality until I save the file.

C-xC-s

Now it is back to ess-mode. C-hvmajor-modeEnter

major-mode is a variable defined in ‘C source code’.
Its value is ‘ess-r-mode’
Original value was fundamental-mode
Local in buffer hw5.Rmd[R]; global value is fundamental-mode
1

The reason I was having this problem is that I didn't have (require 'poly-R) in my init file. I only had (require 'poly-markdown). After adding (require 'poly-R), I can now press Enter within a chunk and it will stay in ess-r-mode.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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