I would like to set the language in the REPL on the fly, with #lang
, not using \"-I\" command-line argument. But this gives me the error \"read: #lang not enabled i
; foo.rkt
#lang whatever
"hi"
is basically the same as
(module foo whatever
"hi")
So as a quick hack you could probably slice off the #lang
line, grab the lang out of it, and stuff the rest of the buffer inside of the (module ...)
form before comint-send-input
-ing it.
Even easier, if you don't mind saving the buffer to disk, first: Just send over ,enter /path/to/file.rkt
to the REPL buffer, or if you're not using XREPL, (enter! "/path/to/file.rkt")
.
Also, it's worth mentioning a few Racket-related modes:
One of them might already do what you want, or, you could peek into how they work (each takes a somewhat different approach to this).