[slime-devel] non-blocking read from REPL

Daniel Patru dpatru at gmail.com
Fri Nov 4 18:39:13 UTC 2005


This is a clarification of my previous question..

My question is: How do I do a non-blocking read in the slime REPL?

I tried (and (listen) (read-line)) and (read-char-no-hang) but keep
getting the message:
; pipelined request... (swank:listener-eval "<input>")
in the minibuffer.

E.g.
CL-USER> (progn (sleep 3) (and (listen) (read-line)))
2
2
CL-USER>
NIL

I typed the first 2, the minibuffer flashed the message
; pipelined request... (swank:listener-eval "2
)
then returned the 2, CL-USER>, and NIL.

In constrast, typing (read-line) without the (listen) works:

CL-USER> (read-line)
2
"2"
NIL

Similar things happen when I try (read-char-no-hang) in place of (and
(listen) (read-line)). Both of these work (function as a non-blocking
read) in a REPL run from the shell (no emacs, no slime.)

It seems that any new input in the slime REPL during a running command
is buffered as a new command instead of as input to the currently
running command.

I tried a blocking read-line after the non-blocking read-line and
typed: 1<newline>2<newline>3<newline>4<newline> and got:
CL-USER> (progn (sleep 10) (and (listen) (read-line)) (print (list
(read-line))))
1
2
3
4
3
CL-USER>
4
CL-USER>
2
CL-USER>
1
CL-USER> 5

("5")
("5")
CL-USER>

I typed the last 5 after the sleep period. It seems that the 1, 2, 3,
and 4 were processed at toplevel while the last 5 was used as input to
unblock the previous read-line.

Is it even possible to do a non-blocking read in the slime REPL, or is
this one of the things I have to give up if I want to use slime?

Thanks,
Dan



More information about the slime-devel mailing list