2

I was wondering how to let racket-mode handle racket language extensions properly?

I tried the following file from the link above (test.rkt):

#lang datalog

ancestor(A, B) :- parent(A, B).
ancestor(A, B) :-
  parent(A, C), D = C, ancestor(D, B).
parent(john, douglas).
parent(bob, john).

ancestor(A, B)?

After C-c C-z, (which launches the REPL with ; Welcome to Racket v8.5 [cs]...), I was able to load the extension if I send the whole buffer (C-c C-c, or racket-run-module-at-point) to the REPL.

> 
ancestor(bob, john).
ancestor(john, douglas).
ancestor(bob, douglas).
test.rkt> 
; Closing REPL session because language's current-read-interaction returned EOF

Process *Racket REPL </>* connection broken by remote peer

But I cannot execute individual regions (and the REPL is terminated). If I just do C-c C-r (racket-send-region) on the first line (or few lines), including the #lang directive, I get an error:

; :2:0: read-syntax: `#lang` not enabled
;   possible reason: not allowed again inside a module that already starts `#lang`, or not enabled for interactive evaluation
; datalog: undefined;
;  cannot reference an identifier before its definition
;   in module: top-level
> 

How to configure Emacs racket-mode in order to make racket-send-region work in above?

(This is with Emacs 28, racket-mode from MELPA, under Ubuntu 22.04 LTS)

1 Answer 1

1

This probably isn't a configuration issue but an issue with #lang datalog and how it interacts (or not) with racket-mode. There are some more detailed discussions about it here and here which could provide another angle.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.