0

I've just installed Chez Scheme and combined it with the Geiser package using this tutorial M-x run-chez runs quite fine but C-x C-e causes the Emacs Lisp rather than Chez Scheme evaluate the code.

I've read through the Geiser cheat sheet but the key combinations listed there didn't seem to work.

What sould I do to evaluate the Chez Scheme code with C-x C-e ? Thanks.

8
  • What major mode is the buffer in? What is ^x^e bound to try ^hv^x^e Commented Aug 13, 2019 at 14:33
  • After I start the Chez Scheme, at the bottom of the buffer frame it writes * Chez REPL * The C-x C-e seems to bound to Emacs Lisp because when I enter it without any input it says Debugger entered--Lisp error: (void-variable >) eval(> nil) elisp--eval-last-sexp(nil) eval-last-sexp(nil) Commented Aug 14, 2019 at 11:04
  • What exactly is ^x^e bound to - use help to get it there should be no seems as to what it is bound to. Commented Aug 14, 2019 at 11:09
  • I don't know how to see what ^x^e is bound to because I can't even know what ^x^e means. Is it C-x C-e? Commented Aug 14, 2019 at 11:12
  • Before Chez Scheme, I had installed Chicken Scheme too and when that mode is activated (M-x run-scheme) the C-x C-e works properly. FYI. Commented Aug 14, 2019 at 11:19

1 Answer 1

2

Here's what I did to get things running in my Emacs on macOS.

  • After installing chez via brew install chezscheme, I started my Emacs.

  • In my scratch buffer I ran (use-package geiser) to install/initialize geiser.

  • Then I ran M-x customize-group geiser, selected "Geiser Chez", changed the "Geiser Chez Binary" from scheme to chez, and clicked "Apply and Save"

  • Created a new file /tmp/foo.ss via C-x C-f

  • The modeline had Racket as the Scheme implementation, so I did C-c C-s chez to change it to Chez

  • Next I did M-x run-geiser chez. The window split with the Chez chez repl on the bottom

  • C-x O to switch out of the Chez repl back to my foo.ss scheme source buffer

  • There I did (+ 1 2) Ret Ret Ret for a cheap Scheme expression and some space

  • Next I did C-x C-e (geiser-eval-last-sexp) and got "=> 3" in the echo area. (It also works with C-x C-b (geiser-eval-buffer)). It looked a bit like this:

screenshot of eval'ing a scheme sexp in geiser+shez

Some things to consider:

  • Make sure "Geiser Chez Binary" is point to the right binary. You can do this in a Geiser buffer with C-h v geiser-chez-binary.

  • Make sure Chez is your active scheme implementation. This will be indicated on your modeline.

  • Try this under emacs -q or emacs -Q. If it works there, but not normally the problem is in your init file(s). Bisect your init file to find the problem.

5
  • Thank you for the answer. However AFAIK the C-x C-e you use seem to invoke the Emacs Lisp not the Chez Scheme. You can check this out by trying a Scheme specific function like (define (myadd arg1 arg2) (+ arg1 arg2)) If C-x C-e returns symbol's function definition is void: define than it really isn't Chez Scheme compiler being invoked. Commented Aug 12, 2019 at 16:25
  • 1
    @Romario Check what the key is bound to - here it is geiser-eval-last-sexp Commented Aug 13, 2019 at 14:32
  • @Romario C-x C-e is bound to geiser-eval-last-sexp. C-c C-b is bound to geiser-eval-buffer and eval'ing your example returns => #<void>. Maybe you have something in your init file rebinding C-x C-e. Try all of this while running emacs with -q or -Q. Commented Aug 13, 2019 at 16:16
  • If I run emacs with -q/-Q all packages are off so I cannot make M-x run-chez or run-geiser and so I cannt test it. Commented Aug 14, 2019 at 11:16
  • Yes. That is the point. You would then use your scratch buffer (in lisp-interaction-mode) to manually initialize geiser. Commented Aug 14, 2019 at 12:48

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.