While I develop some Emacs-Lisp code, I often test it in the *scratch* buffer, just to make sure that what I just wrote behaves like I believe it does.
But sometimes evaluating an expression takes several minutes and it is too bad that Emacs is frozen during this time. I'd love it if *scratch* behaved like the *shell* buffer with an interactive sub-shell. From the manual:
While the subshell is waiting or running a command, you can switch windows or buffers and perform other editing in Emacs. Emacs inserts the output from the subshell into the Shell buffer whenever it has time to process it (e.g., while waiting for keyboard input).
Is there a package that provides such an interactive Emacs-Lisp eval-loop running asynchronously?
I understand that there are technical difficulties. E.g., I always assume that the environment Emacs is maintaining (defined functions, global variable values, ..) is the same for editing and for Lisp-interaction. If the evaluation of my code in *scratch* reveals a bug, I'll amend the code,
eval-defun it, and try it again. So I expect that the eval-loop with which I am communicating in the *scratch* buffer is aware of the new definition.