I like writing specialized little repls sometimes, with syntax optimized for a specific task. When I'm in a repl like that, slime drops many useful features, like M-., arglist display in file buffers, etc.
Is there a way to have those features still work even when I'm in my own repl?
Thanks, Zach
On Tue, Jun 14, 2016 at 12:34 PM, Zach Beane xach@xach.com wrote:
I like writing specialized little repls sometimes, with syntax optimized for a specific task. When I'm in a repl like that, slime drops many useful features, like M-., arglist display in file buffers, etc.
Is there a way to have those features still work even when I'm in my own repl?
After sending a form (a string, really) for evaluation, the SLIME repl enters the slime-repl-read-mode which in fact disables all of those features. Even if those features weren't disabled they wouldn't work properly because, IIUC, REPL requests are serialized and processed by the same thread, thus the REPL would be stuck processing the event that triggered your custom REPL, unable to process other events.
One alternative would be to drop the PL part of your REPL and hook the RE part into swank-repl as follows:
(setq swank-repl::*listener-eval-function* (lambda (string) (swank::with-buffer-syntax () (swank-repl::track-package (lambda () (funcall swank-repl::*send-repl-results-function* (multiple-value-list (YOUR-READER-AND-EVALUATOR string)))))) nil))
Not particularly pretty, but it seems to work.
HTH,
Luís Oliveira luismbo@gmail.com writes:
On Tue, Jun 14, 2016 at 12:34 PM, Zach Beane xach@xach.com wrote:
I like writing specialized little repls sometimes, with syntax optimized for a specific task. When I'm in a repl like that, slime drops many useful features, like M-., arglist display in file buffers, etc.
Is there a way to have those features still work even when I'm in my own repl?
After sending a form (a string, really) for evaluation, the SLIME repl enters the slime-repl-read-mode which in fact disables all of those features. Even if those features weren't disabled they wouldn't work properly because, IIUC, REPL requests are serialized and processed by the same thread, thus the REPL would be stuck processing the event that triggered your custom REPL, unable to process other events.
I don't understand this part "REPL equests are serialized and processed by the same thread" - does that mean the REPL thread is also responsible for M-. action and arglist display in file buffers?
One alternative would be to drop the PL part of your REPL and hook the RE part into swank-repl as follows:
I was really hoping to use the same code both within and without swank.
Zach
On Tue, Jun 14, 2016 at 7:23 PM, Zach Beane xach@xach.com wrote:
I don't understand this part "REPL equests are serialized and processed by the same thread" - does that mean the REPL thread is also responsible for M-. action and arglist display in file buffers?
No, this only affects things going on in the slime-repl buffer.
On second thought, it might not be too hard to change that behavior. (Might need to think the implications through though.) Can you try this? https://gist.github.com/luismbo/b8be134c3b2095a641aa176a957e652f. (No need to restart SLIME or anything, just M-x eval-region that.)
Cheers,
This code has been working nicely so far. I'll keep using it to see if it has any unexpected side effects.
Zach
On Tue, Jun 14, 2016 at 2:44 PM, Luís Oliveira luismbo@gmail.com wrote:
On Tue, Jun 14, 2016 at 7:23 PM, Zach Beane xach@xach.com wrote:
I don't understand this part "REPL equests are serialized and processed by the same thread" - does that mean the REPL thread is also responsible for M-. action and arglist display in file buffers?
No, this only affects things going on in the slime-repl buffer.
On second thought, it might not be too hard to change that behavior. (Might need to think the implications through though.) Can you try this? https://gist.github.com/luismbo/b8be134c3b2095a641aa176a957e652f. (No need to restart SLIME or anything, just M-x eval-region that.)
Cheers,
-- Luís Oliveira http://kerno.org/~luis/