简体   繁体   中英

running scheme from emacs

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 Mx load-library and then entering xscheme at the prompt in the minibuffer. The library loaded, and then I issued the Mx 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 (eg (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 Mx run-scheme . You can evaluate pieces of code by using Cx Ce (to evaluate the sexp before the point) or with CMx to evaluate the sexp you're in right now. You can also load a file with Cc Cl .

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:

  1. Install emacs 24 from the Ubuntu Software Center (search "emacs" and install it!)
  2. Open a terminal ( ALT + CTRL + t )
  3. Go to your home directory ( cd ~ )
  4. Open the hidden file .emacs in gedit ( gedit .emacs )
  5. On the first line of the file, type exactly what's after the colon: (require 'xscheme)
  6. Save the changes to .emacs
  7. That's it!!!

You can now open .scm files in emacs and use commands like Cx Ce .

*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, CMb, Mw, Cxo, Cy and RET .

There are a variation (same, placed just after writing the s-exp): C-spc, CMb, Mw, Cc Cz, Cy and RET

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM