Add the following to your geiser-racket-init-file
:
(require r5rs/init)
Then stick this advice somewhere in your Emacs initialization file(s):
(defadvice run-racket (after enter-r5rs activate)
(switch-to-geiser-module "r5rs"))
That should give you an R5RS-ish experience in Geiser.
EDIT:
I had to deal with this issue recently and found that my above answer was insufficient. For starters, simply switching the module to r5rs
did not, for some strange reason, load symbols that should have been in that module, e.g., set-car!
or set-cdr!
. I found that using geiser-repl-import-module
instead of switch-to-geiser-module
works better because it will actually load expected symbols such as set-car!
, set-cdr!
, etc. Additionally, the behavior of using (geiser-repl-import-module "r5rs")
matches the behavior that one gets by running #lang r5rs
in DrRacket, so it's probably sufficient for most people. However, if you still want to run the plt-r5rs
executable in Geiser, you could try the following:
(progn
(flet ((geiser-racket--parameters () nil))
(let ((geiser-racket-binary "plt-r5rs")
(geiser-repl-skip-version-check-p t))
(ignore-errors
(run-geiser 'racket))
;; to keep your racket history from getting clobbered
(setq-local geiser-repl-history-filename "~/.emacs.d/.plt-r5rs_history"))))
Unfortunately, the resultant REPL functionality from that snippet of code is rather primitive (e.g., you cannot auto-complete symbols). This is because we're removing the geiser-racket--parameters
since those parameters are incompatible with plt-r5rs
and R5RS itself. You'd get quite similar functionality and less convolution by doing C-u M-x run-scheme RET plt-r5rs
.