Browse Source

ob-R: fix interaction with ESS for new sessions

* lisp/ob-R.el (org-babel-R-initiate-session): Properly wait on a new
ESS process.
Aaron Ecay 5 years ago
parent
commit
fcce67cdeb
1 changed files with 4 additions and 3 deletions
  1. 4 3
      lisp/ob-R.el

+ 4 - 3
lisp/ob-R.el

@@ -270,9 +270,10 @@ This function is called by `org-babel-execute-src-block'."
 	    ;; Session buffer exists, but with dead process
 	    (set-buffer session))
 	  (require 'ess) (R)
-	  (ess-wait-for-process
-	   (get-process (or ess-local-process-name
-			    ess-current-process-name)))
+	  (let ((R-proc (get-process (or ess-local-process-name
+					 ess-current-process-name))))
+	    (while (process-get R-proc 'callbacks)
+	      (ess-wait-for-process R-proc)))
 	  (rename-buffer
 	   (if (bufferp session)
 	       (buffer-name session)