ARV
ARV

Reputation: 6907

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. This means that at any point during my typing on the repl, my s-expressions are balanced.

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. 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?

Upvotes: 8

Views: 1444

Answers (2)

abo-abo
abo-abo

Reputation: 20372

Related to your question, lispy provides integration with SLIME.

I typically never type anything into the REPL buffer. Instead, I edit all code in place in the source file, and use e to eval the current sexp.

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

Upvotes: 1

anquegi
anquegi

Reputation: 11542

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

C-j

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 C-j

CL-USER> (defun
)

Upvotes: 2

Related Questions