How to run scheme with Emacs?

后端 未结 3 1104
太阳男子
太阳男子 2021-01-31 18:35

I followed this tutorial and successfully installed Emacs, STk, Quack.

The question is how can I load my program like I do in Racket?

In Racket I can edit my cod

3条回答
  •  太阳男子
    2021-01-31 19:14

    I literally just set this up on my Macbook. Since you didn't specify what system you are on, I will hope you're using some Unix flavor... I'm not familiar with STk really, but this might help you sort out whatever issues you are having, which sound really similar to the problems I faced.

    If you install a Scheme implementation (I am using MIT Scheme, edited to add that this also works with Racket, using mzscheme) it may come with a symlink named "scheme" - this is what Emacs looks for, I think.

    If it doesn't (MIT Scheme doesn't seem to on OS X) you can edit your Emacs configuration, in Emacs type M-x customize-group then type scheme. Scroll down a bit and find the Scheme program name field. Change it to your Scheme implementation command, like mit-scheme or mzscheme. You can also just create a symlink in your PATH which points to the right binary:

    sudo ln -s /Applications/mit-scheme.app/Contents/Resources/mit-scheme
        /usr/local/bin/scheme
    

    For MIT Scheme, you also need to set the MITSCHEME-LIBRARY-PATH variable, so add this to your .emacs.

    (setenv "MITSCHEME_LIBRARY_PATH"
        "/Applications/mit-scheme.app/Contents/Resources")
    

    Then you should be able to start an inferior Scheme buffer with M-x run-scheme. And pass code to the REPL with C-x C-e, which evaluates the expression before the point.

    If this doesn't work (it didn't for me) you may need to make sure that the path Emacs uses for executing shell commands includes the scheme symlink or whatever directory contains the binary for your implementation. With some experimentation, I fixed this by adding this to my .emacs file:

    Emacs is ignoring my path when it runs a compile command

    For references, the other SO question which I used to set this up:

    How do I get a scheme interpreter working inside Emacs?

提交回复
热议问题