我无法关闭最后一个括号并使用 Slime 中的 lisp 模式将我的函数发送到 REPL
这是一个非常简单的问题。 我已经安装了 Emacs 22.2.1(来自 Ubuntu (9.04) 存储库,并从其主页上的存储库下载了 Slime-current。
我按照 slime 提供的说明进行操作,它可以工作。我可以启动 slime 并按预期使用它。
但是 我无法再与 REPL 交互。当我按下 Enter 键时,光标只是移动到下一行。
有人对此有解决办法吗?
,当我进入 lisp-mode (Mx lisp-mode) 时, >编辑:
关于我如何使用 Emacs 的问题是的,我启动 Emacs,然后使用 Mx slime 输入 slime,我读到接下来使用 Mx lisp-mode 进入 lisp 模式可以获得正确的语法突出显示。它
确实提供了语法突出显示,但正如下面指出的,它用于编辑文本文件,而不是与 REPL 交互。
我最近还读到,将以下内容放入我的 .emacs 文件中将启用语法突出显示(它不起作用)。
; Syntax Highlighting
(global-font-lock-mode 1)
; Enable slime
(add-to-list 'load-path "/home/doug/Software/slime/") ; your SLIME directory
(setq inferior-lisp-program "/home/doug/Software/ccl/ccl") ; your Lisp system
(require 'slime)
(slime-setup)
; Enable psvn
(require 'psvn)
所以我想我的问题需要修改。由于 lisp-mode 并不意味着简单地为 slime 启用 lisp 功能,那么我如何在 slime 中启用语法突出显示呢?
编辑2:
答案在评论中提供。
启动 slime,然后打开/创建一个新文件来使用。 这是打算使用 lisp 模式的缓冲区。
该函数被写入、突出显示并发送到 REPL。 输出显示在底部。
两者应该合作,而不是融合。
This is a very simple question. I have installed Emacs 22.2.1 (from the Ubuntu (9.04) repo and I downloaded Slime-current from the repo on their homepage.
I followed the instructions provided with slime and it works. I can start slime and use it as expected.
However, when I enter lisp-mode (M-x lisp-mode) I can no longer interact with the REPL. Nothing I type works, the cursor just moves to the next line when I press enter.
Does anyone have a fix for this?
Edit:
Regarding the question of how I'm using Emacs. Yes, I start Emacs, then enter slime with M-x slime. I read that I could get proper syntax highlighting by next entering lisp mode with M-x lisp-mode.
It did provide syntax highlighting, but as pointed out below, it's meant for editing text files, not interacting with the REPL.
I also recently read that placing the following in my .emacs file will enable syntax highlighting (it did not work).
; Syntax Highlighting
(global-font-lock-mode 1)
; Enable slime
(add-to-list 'load-path "/home/doug/Software/slime/") ; your SLIME directory
(setq inferior-lisp-program "/home/doug/Software/ccl/ccl") ; your Lisp system
(require 'slime)
(slime-setup)
; Enable psvn
(require 'psvn)
So I guess my question needs revising. Since lisp-mode isn't meant to simply enable lisp features for slime, then how I enable syntax highlighting in slime?
Edit 2:
The answer was provided in a comment.
Start slime then open/create a new file to work with. This is the buffer where lisp-mode is intended to be used.
The function is written, highlighted, and sent to the REPL. The output appears at the bottom.
The two are supposed to cooperate, not integrate.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
移出注释:通常,您不会直接在 REPL 缓冲区中编写大函数,而是将它们写入另一个缓冲区中,然后通过 Cc Cc 将它们发送到 REPL。 slime-repl-mode 有它自己的突出显示,但有不同的目的:它以不同的颜色显示输入、输出和系统消息(在我的黑底绿设置中,它以绿色显示输入,以红色显示系统消息,并以浅蓝色输出)。
Moved out of comments: usually, you would not write big functions directly in the REPL buffer, but write them in another buffer and send them to the REPL via
C-c C-c
. The slime-repl-mode has its own highlighting, but with a different purpose: it shows input, output, and system messages in different colours (in my green-on-black setup, it shows input in green, system messages in red, and output in light blue).听起来您正在具有 REPL 的缓冲区中输入
lisp-mode
,是吗? 如果是这样的话,那可能就是你做错了。 REPL 缓冲区可能有它自己的模式。查看文档,与 Slime 交互的方式(与大多数 Emacs 的劣等进程一样)是使用评估当前 sexp 或区域或缓冲区的绑定。 请参阅此文档页面。 该链接中的任何绑定都不是简单的 RET 键 - 这让我相信您更改了 REPL 缓冲区的模式。
更多信息当然会有帮助。
It sounds like you're entering
lisp-mode
in the buffer that has the REPL, yes? If that's the case, that's probably what you're doing wrong. The REPL buffer probably has its own mode.Looking at the documentation, the way to interact with Slime (as with most Emacs' inferior processes) is to use bindings that evaluate the current sexp or region or buffer. See this page of the documentation. None of the bindings in that link are the simple
RET
key - which is leads me to believe you changed the mode of the REPL buffer.More information would help of course.
当你执行 Mx slime 时,Slime 启动并显示 REPL(带有 REPL 的缓冲区将处于 slime-repl-mode 主要模式。这个 slime-repl-mode 驱动 REPL。lisp
-mode,根据它的描述,是a “编辑除 GNU Emacs Lisp 之外的 Lisp 代码的主要模式”是用于编辑文件,而不是用于 REPL。
这是有意的行为。
相反,为什么要将 REPL 切换到 lisp 模式?
When you do M-x slime, Slime starts and shows the REPL (the buffer with the REPL will be in the slime-repl-mode major mode. This slime-repl-mode drives the REPL.
lisp-mode, according to its description, is a "Major mode for editing Lisp code for Lisps other than GNU Emacs Lisp". Lisp-mode is for editing files, not for REPL.
This is intended behaviour.
Rather, why do you want to switch the REPL to lisp-mode?