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 code in the upper window, type some codes, save and run. Then the lower window will automatically loaded the code I just wrote. Then I can play with it.
I've tried M-x run-scheme. It only brings me into type mit-scheme. Then it says No such file or directory exists. Then I tried F5 (The author from the site wrote a .emacs file enables me to press F5). Then the STk opens up. I can load my scheme file in STk. But it will brings me back to MIT Scheme with edwin.
I want to have the same thing in Racket (Write/REPL). But more flexibility with the key movement. In Racket you don't have C-f C-n C-a...etc.
Could anyone teach me how to do so?
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?
The 64-bit download from GNU now has the .app named as "MIT:GNU Scheme.app." I tried @spacemanaki's instructions but I kept getting:
bash-3.2$ export MITSCHEME_LIBRARY_PATH=/Applications/MIT:GNU\ Scheme.app/Contents/Resources bash-3.2$ scheme scheme: can't find a readable default for option --band. searched for file all.com in these directories: /Applications/MIT /Applications/MIT:GNU Scheme.app/Contents/Resources/GNU Scheme.app/Contents/Resources
Eventually I realized the semicolon was acting as a path separator. So just make sure you rename it:
mv MIT:GNU\ Scheme.app/ mit-scheme.app
Then the above instructions will work fine - although you may have to use Finder to do the rename, because when I did it on the shell my Resources folder disappeared.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With