I'm a newbie to LISP.
I am attempting to invoke the scheme interpreter from within emacs (version 23 running on windows). I loaded the xscheme library by telling emacs to M-x load-library
and then entering xscheme
at the prompt in the minibuffer. The library loaded, and then I issued the M-x run-scheme
command. (I realize that all this loading can be done from .emacs at startup, but I am not concerned with that at the moment.)
So far so good - the *scheme*
buffer has been created, and now I'm hoping that I'm able to talk to the scheme interpreter.
However, when I try to evaluate something in that *scheme*
buffer (e.g. (define shoe-size 14)
), I get this Output file descriptor of scheme is closed
message in the minibuffer.
Does anybody know how to fix this in emacs?
(Also, how does one set the major-mode as REPL in the *scheme*
buffer?)
Thank you.
Try setting the scheme-program-name
variable to the path to your Scheme interpreter. The major-mode of the scheme buffer is probably just comint
and you cannot do much about it unless you switch to something more capable like Geiser - something that I'd recommend you do.
Add this line to your .emacs
file:
(setq scheme-program-name "gsi")
(Replace "gsi"
with the name of your Scheme interpreter.)
You can then start the interpreter with M-x run-scheme
. You can evaluate pieces of code by using C-x C-e
(to evaluate the sexp before the point) or with C-M-x
to evaluate the sexp you're in right now. You can also load a file with C-c C-l
.
I'll start by saying that I'm very new to programming, scheme and SICP, but I'm trying to work through the course and watch the lectures that are online.
I'm running emacs on Ubuntu 12.10 and I really wanted to get MIT scheme working in emacs instead of relying on Edwin.
The above tips didn't work for me, but here's the step-by-step instructions that did work:
- Install emacs 24 from the Ubuntu Software Center (search "emacs" and install it!)
- Open a terminal (ALT + CTRL + t)
- Go to your home directory (
cd ~
)
- Open the hidden file
.emacs
in gedit (gedit .emacs
)
- On the first line of the file, type exactly what's after the colon: (require 'xscheme)
- Save the changes to
.emacs
- That's it!!!
You can now open .scm
files in emacs and use commands like C-x
C-e
.
*directions courtesy of http://alexott.net/en/writings/emacs-devenv/EmacsScheme.html#sec14
My guess is that it's just a known issue I still dunno how to sort that out (it's out of my current skills) but I got a macro that probably helps: just after writing the s-exp you can do Cc-Cz
(it calls the geiser REPL) then C-spc, C-M-b, M-w, C-x-o, C-y
and RET
.
There are a variation (same, placed just after writing the s-exp): C-spc, C-M-b, M-w, C-c Cz, C-y
and RET