如何使用Emacs运行方案? [英] How to run scheme with Emacs?

查看:129
本文介绍了如何使用Emacs运行方案?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遵循这个教程,并成功安装了Emacs,STk,Quack。



问题是如何在Racket中加载我的程序?



在Racket中,我可以在上面的窗口中编辑我的代码,键入一些代码,保存并运行。那么下面的窗口会自动加载我刚才写的代码。然后我可以玩它。



我试过M-x运行方案。它只带我进入类型mit-scheme。然后它说没有这样的文件或目录存在。然后我尝试了F5(作者从网站上写了一个.emacs文件让我按F5)。然后STk开了。我可以在STk中加载我的方案文件。但是,它会带回我与edwin的麻省理工学院计划。



我想在Racket(Write / REPL)中有相同的东西。但更为灵活的关键运动。在Racket中,你没有Cf Cn Ca ...等等。



有没有人可以教我怎么做?

解决方案

我的字面上只是设置在我的Macbook上。既然你没有指定你正在使用什么系统,我希望你使用一些Unix的风格...我对STk不太熟悉,但这可能有助于你整理出你所遇到的任何问题,这听起来真的类似于我面临的问题。



如果您安装Scheme实现(我正在使用MIT Scheme,编辑补充说,这也适用于Racket,使用mzscheme)它可能有一个名为scheme的符号链接 - 这是Emacs寻找的,我想。



如果没有(麻省理工学院计划似乎不在OS X ),您可以在Emacs类型 Mx customize-group 中编辑您的Emacs配置,然后键入 scheme 。向下滚动一下,找到方案程序名称字段。将其更改为您的Scheme实现命令,例如 mit-scheme mzscheme 。您也可以在PATH中创建一个指向正确二进制文件的符号链接:

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

对于MIT计划,您还需要设置MITSCHEME-LIBRARY-PATH变量,因此将其添加到您的 .emacs

 (setenvMITSCHEME_LIBRARY_PATH
/Applications/mit-scheme.app/Contents/Resources)
/ pre>

然后,您应该可以使用 Mx run-scheme 启动一个劣质的Scheme缓冲区。并使用 Cx Ce 将代码传递给REPL,该值用于评估点之前的表达式。



你可能需要确保Emacs用于执行shell命令的路径包括方案符号链接或任何目录包含您的二进制文件实现。通过一些实验,我通过将其添加到我的 .emacs 文件中:



Emacs在运行编译命令时忽略我的路径



对于引用,我曾经设置的其他SO问题:



如何在Emacs中获得一个方案解释器?


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?

这篇关于如何使用Emacs运行方案?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆