SLIME on Emacs with paredit in repl - how to prevent execution of incomplete but balanced expressions?
Asked Answered
S

2

8

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?

Selfpossessed answered 14/11, 2017 at 10:57 Comment(3)
Use C-j instead.Boykins
That worked. Thanks!Selfpossessed
Also consider using the slime scratch buffer for multi line expressions, much more convenient than the realHeywood
S
2

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
)
Signalman answered 16/11, 2017 at 7:38 Comment(1)
Thanks - the last part, using C-j instead of enter when writing an expression worked for me tooMigratory
A
1

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.

Accusal answered 17/11, 2017 at 17:7 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.