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?
当使用命令M-n r和M-n P编译* .Rnw文件时,我的开放R缓冲区被交换为缓冲区,该缓冲区似乎显示编织器编译信息。如果knitr编译没有任何错误,有没有办法自动切换回R缓冲区?
1 个解决方案
#1
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
现在,我不知道哪个函数在r模式下处理编译,但假设它是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表达式来检查编译是否没有错误。
#1
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
现在,我不知道哪个函数在r模式下处理编译,但假设它是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表达式来检查编译是否没有错误。