M-x eval-buffer
evaluates lisp code in a buffer. How do I evaluate mit-scheme code written in a buffer?
In vanilla emacs you can do run-scheme
, to start a scheme
repl. Then you can use the different functions available for evaluating the scheme code in the repl.
For example given you are in scheme-mode
, suppose you have following code in the scheme buffer
(define (test a b)
(+ a b))
After starting the repl with run-scheme
, you can go to the end of function definition and do C-x C-e
, to evaluate it in the repl. Now you have the test
function defined in the repl, to test this type the following in the buffer
(test 1 3)
Go to the end of the sexp and do C-x C-e
again, this will print 4 in the repl. Also you can use C-c C-l
to load the entire file at once.
Do C-h m
to find out the different keybindings for evaluating scheme code. You can also use the menu to discover the different functions available.
Other option is to use slime
as far as I know you will need some extra setup to use mit-scheme
with slime, the instructions are present in the contrib/swank-mit-scheme.scm
file in slime's main folder.