简体   繁体   English

我无法关闭最后一个括号并使用Slime中的lisp-mode将函数发送给REPL

[英]I can't close the last parenthesis and send my function to the REPL using lisp-mode in Slime

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. 我已经从Ubuntu(9.04)存储库安装了Emacs 22.2.1,并从其主页上的存储库下载了Slime-current。

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 (Mx lisp-mode) I can no longer interact with the REPL. 但是,当我进入Lisp模式(Mx Lisp模式)时,我将无法与REPL进行交互。 Nothing I type works, the cursor just moves to the next line when I press enter. 我键入的内容无效,按Enter键时光标仅移至下一行。

Does anyone have a fix for this? 有人对此有解决办法吗?

Edit: 编辑:

Regarding the question of how I'm using Emacs. 关于我如何使用Emacs的问题。 Yes, I start Emacs, then enter slime with Mx slime. 是的,我启动Emacs,然后使用Mx粘液输入粘液。 I read that I could get proper syntax highlighting by next entering lisp mode with Mx lisp-mode. 我读到我可以通过接下来使用Mx lisp-mode进入lisp模式来正确显示语法。

It did provide syntax highlighting, but as pointed out below, it's meant for editing text files, not interacting with the REPL. 它确实提供了语法突出显示功能,但是如下所述,它是用于编辑文本文件,而不是与REPL交互。

I also recently read that placing the following in my .emacs file will enable syntax highlighting (it did not work). 我最近还读到,将以下内容放在我的.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)

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? 由于lisp-mode并不意味着仅仅为粘液启用lisp功能,那么如何在粘液中启用语法高亮显示?

Edit 2: 编辑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. 这是打算使用lisp-mode的缓冲区。

The function is written, highlighted, and sent to the REPL. 该函数将被编写,突出显示并发送给REPL。 The output appears at the bottom. 输出显示在底部。

The two are supposed to cooperate, not integrate. 两者应该合作,而不是整合。

It sounds like you're entering lisp-mode in the buffer that has the REPL, yes? 听起来您正在具有REPL的缓冲区中进入lisp-mode ,是吗? If that's the case, that's probably what you're doing wrong. 如果是这样,那可能是您做错了。 The REPL buffer probably has its own mode. REPL缓冲区可能具有自己的模式。

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. 查看文档,与Slime交互的方式(与大多数Emacs的劣等流程一样)是使用评估当前sexp或区域或缓冲区的绑定。 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. 该链接中没有任何绑定是简单的RET键-这使我相信您更改了REPL缓冲区的模式。

More information would help of course. 更多信息当然会有所帮助。

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 Cc Cc . 删除注释:通常,您不会直接在REPL缓冲区中编写大型函数,而是将它们写入另一个缓冲区中,然后通过Cc Cc将其发送给REPL。 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). 粘液替换模式有其自身的突出显示,但用途不同:它以不同的颜色显示输入,输出和系统消息(在我的黑底绿设置中,它以绿色显示输入,系统消息以红色显示,并以浅蓝色输出)。

When you do Mx 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. 当您执行Mx粘液时,Slime会启动并显示REPL(带有REPL的缓冲区将处于粘液替换模式主模式。此粘液替换模式将驱动REPL。

lisp-mode, according to its description, is a "Major mode for editing Lisp code for Lisps other than GNU Emacs Lisp". 根据其描述,lisp-mode是“用于为Lisps编辑Lisp代码的主要模式,而不是GNU Emacs Lisp”。 Lisp-mode is for editing files, not for REPL. Lisp模式用于编辑文件,而不用于REPL。 This is intended behaviour. 这是预期的行为。

Rather, why do you want to switch the REPL to lisp-mode? 而是为什么要将REPL切换为Lisp模式?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM