Emacs org-babel is an excellent notebook tool for exploratory and interactive statistics in ESS. Now, I need to run very heavy scripts in R and the entire interface of emacs hungs for the duration of the code execution. This is an important limitation of babel.

  • Are there ways of avoiding this?

Here is a MWE:

#+begin_src R :results output


var1 = paste0("varA", 1:3)
var2 = paste0("varB", 1:3)

tmp = umx_scale_wide_twin_data(varsToScale= c(var1, var2), sep= "_T", data= docData)

mzData = subset(docData, zygosity %in% c("MZFF", "MZMM"))
dzData = subset(docData, zygosity %in% c("DZFF", "DZMM"))

m1 = umxDoCp(var1, var2, mzData= mzData, dzData= dzData, sep = "_T",
             causal= TRUE, autoRun = F)


Update: I already tried ob-async, but it is not compatible with : session, which reduces babel usefulnes.

  • 1
    Clarify what you mean by "hung". If it's just a slowdown, or Emacs is legitimately waiting for something, then your question might make sense here. But if the Emacs process is really hung, that's similar to a crash, and you should report it using M-x report-emacs-bug. And please specify your Emacs version: M-x emacs-version.
    – Drew
    Nov 28, 2021 at 15:41
  • 1
    Maybe ob-async can help?
    – NickD
    Nov 28, 2021 at 19:35
  • 1
    github.com/jackkamm/ob-session-async seems to be what you are looking for, but he says that the functionality is already in upstream Org mode.
    – NickD
    Nov 29, 2021 at 1:24
  • @NickD this looks promising, let me test
    – lf_araujo
    Nov 29, 2021 at 1:25
  • Sometimes Emacs waits for a babel block to finish, sometimes it doesn't. I'm not sure why. If it freezes while you're waiting for the cose to finish, C-g sometimes enables you to continue editing without stopping the calculation. Since you're running in a session, you can see for yourself if execution has stopped after you try this.
    – Tyler
    Nov 29, 2021 at 3:20

1 Answer 1


When Emacs is waiting for an orgmode cose block to run, you can regain control with 'C-g'. I'm not sure why this works, but so far I haven't had the cose block stop running when I do this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.