Here’s another version of the previous patch which fixes a couple bugs related to 1) changing the window configuration unwarrantedly 2) syntactically invalid R code (mismatched parens or quotes) could hang emacs It’s easy to get R to throw an error in the mismatched-parens case, but more difficult to recover from the mismatched-quotes one. Thus, when babel detects such a case it bails and signals a user-error in emacs. (Under the present code in master, both the mismatched-parens and mismatched-quotes cases hang emacs pending a manual C-g.) The patch is now firmly into the territory of gross hacks, so I’d much prefer the evaluate-based approach if it can be made palatable.