Playing nice with custom repls?
Luís Oliveira
luismbo at gmail.com
Tue Jun 14 14:01:21 UTC 2016
On Tue, Jun 14, 2016 at 12:34 PM, Zach Beane <xach at 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
http://kerno.org/~luis/
More information about the slime-devel
mailing list