I just noticed one more thing, regarding ess-eval-visibly etc: >> + (setq user-inject-src-param ess-inject-source) >> (setq ess-eval-visibly nil) >> + (setq ess-inject-source 'function-and-buffer) >> (ess-eval-buffer nil)) >> - (setq ess-eval-visibly tmp) >> + (setq ess-eval-visibly tmp) >> + (setq ess-inject-source user-inject-src-param) > > Rather than using setq, it would be better to let bind these like so: > > (let ((ess-eval-visibly nil) > (ess-inject-source 'function-and-buffer)) > ...code in here... > )
I noticed these variables are only reset to defaults when ":results output". It may also be necessary to set them as well for the case of ":results value". In my original implementation [1], I set "ess-eval-visibly" within the wrapping advice function, so it applied to all cases. [1] https://github.com/jackkamm/ob-session-async/blob/master/lisp/ob-session-async-R.el