SLIME on Emacs with paredit in repl - how to prevent incomplete but balanced expressions from being executed?

I am using paredit for emacs with SLIME replacement. This means that at any time when I type in repl, my s-expressions are balanced.

However, they may be incomplete, and I might want to continue typing them inside another line, as shown below:

CL-USER> (defun print-hello () ) 

When I start a new line by pressing the enter key, however, SLIME repl fulfills my incomplete expression. I want him to wait for me to complete the expression as follows:

 CL-USER> (defun print-hello () (format t "Hello, world")) 

How to do this, please?

+5
source share
2 answers

In these situations, when writing long s-expressions in REPL, I think the best way is to use slime scratch buffer . you can edit it and after that execute with

CJ

There is no problem pressing input inside the buffer, I use a trick, but the capture may be like this:

 (defun print-hello () (format t "Hello, world")) ; => PRINT-HELLO 

Also another alternative works without the last parent: - (

or, as suggested in a comment by @jkiisky, enter an expression and add s Cj in the middle of the expression

 CL-USER> (defun ) 
0
source

In connection with your question, lispy provides integration with SLIME.

I usually don’t write anything to the REPL buffer. Instead, I edit all the code in the source file and use e to evaluate the current sexp.

lispy also a super-set of paredit if your compatibility issue is.

0
source

Source: https://habr.com/ru/post/1273352/


All Articles