I am searching for a piece of emacs-lisp code that checks if an emacs-babel block finished its execution.
I am trying to write smth like
(while (babel-block not finished its execution) (sleep-for 0.1)) (do smth)
Thank you in advance.
I will maybe try to be more specific to foster the understanding.
I have the following piece of code for executing a babel block after the cursor.
(defun execute-after-cursor () "Execute the block up until after the cursor" (interactive) (let* ((el (org-element-context)) (p (point)) (language (org-element-property :language el)) (switches (org-element-property :switches el)) (parameters (org-element-property :parameters el))) (insert (format "\n#+END_SRC ,#+BEGIN_SRC %s %s %s\n" language (or switches "") (or parameters "")))) (org-babel-execute-src-block) (previous-line 3) (kill-line 3) )
The issue is now that when I execute the above in EIN; I do not get the results displayed. I noticed that if I put a time
(sleep-for 1) it works. I guess that EIN binds the results to the named babel block and if emacs deletes the name of the cell before EIN finishes the execution works but the results do not show.
Hope this gives you a better intuition of why I need the piece of code above.