[英]SLIME on Emacs with paredit in repl - how to prevent execution of incomplete but balanced expressions?
I use paredit on emacs with SLIME's repl. 我使用SLIME的repl在emacs上使用paredit。 This means that at any point during my typing on the repl, my s-expressions are balanced.
这意味着在我在repl上输入的任何时候,我的s表达式都是平衡的。
However, they may not be complete, and I might want to continue typing inside them in another line, as follows: 但是,它们可能不完整,我可能想继续在另一行中输入内容,如下所示:
CL-USER> (defun print-hello ()
)
When I start a new line by pressing the enter key, however, the SLIME repl executes my incomplete expression. 但是,当我按回车键开始新行时,SLIME repl会执行我的不完整表达式。 I want it to wait for me to complete the expression, as follows:
我希望它等待我完成表达式,如下所示:
CL-USER> (defun print-hello ()
(format t "Hello, world"))
How do I make this happen please? 我该如何做到这一点呢?
For that situations, when writing long s-expressions in REPL I think that the best way is to use the slime scratch buffer . 对于那种情况,当在REPL中编写长s表达式时,我认为最好的方法是使用slime scratch缓冲区 。 you can edit it and after that execute with
你可以编辑它,之后执行
Cj
CJ
No problem pressing enter inside the buffer, I'm using sly but the capture could be like this: 没有问题按缓冲区内的输入,我使用狡猾,但捕获可能是这样的:
(defun print-hello ()
(format t "Hello, world"))
; => PRINT-HELLO
Also another alternative is working without the last parent :-( 另一个替代方案是没有最后一个父母:-(
or as suggested in a comment by @jkiisky, type the expression and add in the middle of the s expression Cj
或者如@jkiisky的评论中所建议的那样,输入表达式并添加到s表达式
Cj
的中间
CL-USER> (defun
)
Related to your question, lispy provides integration with SLIME. 与您的问题相关, lispy提供与SLIME的集成。
I typically never type anything into the REPL buffer. 我通常不会在REPL缓冲区中输入任何内容。 Instead, I edit all code in place in the source file, and use e to eval the current sexp.
相反,我编辑源文件中的所有代码,并使用e来评估当前的sexp。
lispy
is also a super-set of paredit
, if compatibility is your concern. 如果兼容性是您的关注
paredit
,那么lispy
也是一个超级的paredit
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.