如何使用Emacs运行方案?
我按照这个教程并成功安装了Emacs、STk、Quack。
问题是我怎样才能像在 Racket 中那样加载我的程序?
在 Racket 中,我可以在上方窗口中编辑代码,输入一些代码,保存并运行。然后下面的窗口就会自动加载我刚刚写的代码。然后我就可以玩它了。
我尝试过 Mx 运行方案。它只会让我进入类型麻省理工学院计划。然后它说不存在这样的文件或目录。然后我尝试了F5(该网站的作者编写了一个.emacs文件使我可以按F5)。然后 STk 打开。我可以在 STk 中加载我的方案文件。但这会让我和埃德温一起回到麻省理工学院的计划。
我想在 Racket 中拥有同样的东西(Write/REPL)。但按键移动更加灵活。在 Racket 中,您没有 Cf Cn Ca...等。
有人可以教我怎么做吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我实际上只是在我的 Macbook 上设置了这个。既然你没有指定你所在的系统,我希望你使用一些 Unix 风格...我真的不熟悉 STk,但这可能会帮助你解决你遇到的任何问题,这听起来确实与我遇到的问题类似。
如果你安装一个Scheme实现(我正在使用MIT的Scheme,编辑后添加它也适用于Racket,使用mzscheme),它可能带有一个名为“scheme”的符号链接 - 我认为这就是Emacs所寻找的。
如果没有(MIT Scheme 在 OS X 上似乎没有),您可以编辑 Emacs 配置,在 Emacs 中输入
Mxcustomize-group
,然后输入scheme
。向下滚动一点并找到Scheme 程序名称
字段。将其更改为您的Scheme实现命令,例如mit-scheme
或mzscheme
。您还可以在 PATH 中创建一个指向正确二进制文件的符号链接:对于 MIT Scheme,您还需要设置 MITSCHEME-LIBRARY-PATH 变量,因此将其添加到您的
.emacs
中。然后您应该能够使用
Mx run-scheme
启动一个较差的Scheme缓冲区。并使用Cx Ce
将代码传递给 REPL,该 REPL 会计算该点之前的表达式。如果这不起作用(对我来说不起作用),您可能需要确保 Emacs 用于执行 shell 命令的路径包含
scheme
符号链接或包含用于实现的二进制文件的任何目录。经过一些实验,我通过将其添加到我的.emacs
文件中解决了这个问题:Emacs 在运行编译命令时忽略我的路径
作为参考,我用来设置它的另一个 SO 问题:
如何让方案解释器在 Emacs 中工作?
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 typescheme
. Scroll down a bit and find theScheme program name
field. Change it to your Scheme implementation command, likemit-scheme
ormzscheme
. You can also just create a symlink in your PATH which points to the right binary:For MIT Scheme, you also need to set the MITSCHEME-LIBRARY-PATH variable, so add this to your
.emacs
.Then you should be able to start an inferior Scheme buffer with
M-x run-scheme
. And pass code to the REPL withC-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?
从 GNU 下载的 64 位版本现在的 .app 名为“MIT:GNU Scheme.app”。我尝试了 @spacemanaki 的说明,但我不断收到:
最终我意识到分号充当了路径分隔符。因此,只需确保您重命名它:
然后上述说明将正常工作 - 尽管您可能必须使用 Finder 来进行重命名,因为当我在 shell 上执行此操作时,我的 Resources 文件夹消失了。
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:
Eventually I realized the semicolon was acting as a path separator. So just make sure you rename it:
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.
如果您使用的是 Mac,我建议使用
Homebrew
通过简单的命令brew install mit-scheme
安装 mit-scheme。找到您的~/.emacs 文件
,如果不存在则创建一个,将其附加到文件末尾:使用
which mit-scheme
命令找出您的已安装 mit-scheme。以我的 MacOS X 为例:
保存并退出。
然后重新启动 Emacs 并输入
M+x
,您就进入了 mit-sheme。I would recommend to use
Homebrew
to install the mit-scheme with simple commandbrew install mit-scheme
if your are on a Mac. Find your~/.emacs file
, if it not exists then create one, append this to the end of the file:Use
which mit-scheme
command to find out where your mit-scheme was installed.Take my MacOS X as an example:
Save it and quit.
Then restart your Emacs and type
M+x
and you are in the mit-sheme.