tags:

views:

147

answers:

4

How do I get the EMACS lisp interpreter use the Scheme dialect of LISP. I am going over the SICP book and am new to EMACS (just finished learning the navigation and file access commands)?

A: 

You don't, at least not directly. What people generally do is spawn a scheme process and communicate directly with that.

See external-lisp documentation for how to do that, as well as the Emacs Wiki page for Scheme.

Ok, I was a little wrong, it looks as though a couple of people have written Scheme interpreters on top of Emacs Lisp (see the Wiki link above), though they are not fully featured Schemes.

Trey Jackson
A: 

You don't. GNU Emacs LISP is built into GNU Emacs, and much of GNU Emacs is written in GNU Emacs LISP. You can't change the built-in LISP interpreter without massively breaking Emacs.

GNU/MIT Scheme includes the Edwin editor, an Emacs-like editor written in Scheme. You might be able to use that instead of GNU Emacs.

The other guy's recommendation of spawing a scheme process and communicating with that seems like the better idea.

John R. Strohm
+2  A: 

To do SICP, you should use an external scheme interpreter as Emacs Lisp is different from Scheme and no correct implementation of scheme has been created on top of Emacs Lisp. One other reason you should use an external scheme interpreter is for speed of execution.

The simple solution is to use PLT Scheme now called Racket :

  • Download and Install scheme from Racket site.

  • Then configure the variable scheme-program-name to the value mzscheme

  • Finally run the command run-scheme : it will run mzscheme process into a *scheme* buffer.

The *scheme* buffer use the inferior-scheme-mode major mode which defines the following keys :

C-c C-k scheme-compile-file

C-c C-l scheme-load-file

C-x C-e scheme-send-last-sexp

C-M-x scheme-send-definition

Jérôme Radix
+1  A: 

Jerome's answer is a good simple way to get started. If you plan on working through longer exercises in SICP, I strongly suggest installing Quack, which is an Emacs package that provides many useful features for formatting, editing, and running Scheme code. It's the de facto standard.

You'll still have to install your preferred dialect of Scheme (I also suggest Racket here) independently, and then use Emacs to communicate with it.

This page and this other page might help you with some other resources for setting up and using Emacs for this purpose.

mquander