8

When compiling an *.Rnw file with the commands M-n r and M-n P my open R buffer is swapped for a buffer that appears to shows knitr compilation information. Is there a way to automatically switch back to the R buffer if knitr compiles without any errors?

Chernoff
  • 2,494
  • 2
  • 20
  • 24

1 Answers1

1

Well the easiest way is to advice the function. An advice is a way the add something at the beginning, end (or both) of the function.

Now, I don't know which function takes care of compilation in r-mode, but assuming it is foo

(defadvice foo (after foo-advice () activate)
(other-window 1))

You just have to add an if expression to check if the compilation was error free.

PuercoPop
  • 6,707
  • 4
  • 30
  • 40