Can I background a running thread in the Slime (Swank Emacs)
Asked Answered
L

3

7

I often find my self starting some long running process from the REPL and then wish I could carry on using the REPL for other tasks while it was running. Can I use slime to background the current thread or start a new REPL control thread? Starting an additional REPL buffer would be fine as well.

Leeannaleeanne answered 9/8, 2012 at 0:30 Comment(0)
G
2

Edit:

Hm, I somehow managed to miss the Clojure tag on your question. I would be very suprised if the solution below worked for Clojure, since, as you probably know, the Clojure community unfortunately (at least for those of us using Clojure and CL) maintains its own version of Slime. I won't delete the answer, because it might be helpful for CL programmers searching for this functionality.

Unless there is a similar solution for Clojure, which allows multiple REPLs multiplexed over a single socket, you could maybe just start a second Swank server by hand (from the *inferior-lisp* buffer) and connect to it via slime-connect as a workaround. (Can't test this ATM, since I stopped using Slime with Clojure a while ago.)


Did you try the slime-mrepl contrib? I have not actually used it myself, but a quick test worked for me under CCL/Win/Emacs 24.

I tested it like this: M-x slime, enter (sleep 10) in the REPL, switch buffer, M-x slime-new-mrepl.

Gynaeceum answered 9/8, 2012 at 1:18 Comment(0)
D
2

Please forgive me for a somewhat trite and non-slime specific answer; on the upside it will work with any clojure REPL.

When I know in advance I am starting a long running task from the REPL then I start the computation using future and check with future-done? before deref-ing it.

Debroahdebs answered 9/8, 2012 at 19:55 Comment(0)
C
1

This might not answer your question, but it might be helpful to realize that as long as (slime-communication-style) is :spawn, evaluations done using C-x C-e always spawn their own thread and can run in parallel to whatever is happening in the REPL thread. Output (from println etc.) will appear in the REPL buffer.

Cosmonaut answered 13/8, 2012 at 10:0 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.