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?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With