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?
emacs. d/ . The first lisp file you load you may need to perform M-x slime , which means holding down either Alt or Escape, then hitting the letter 'x'. A prompt will appear at the bottom of the editor (in the minibuffer) where you type "slime" and hit enter.
Place your cursor inside the 'slime-smart-quit routine and type M-x edebug-defun . Then exit Emacs as you normally would.
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
)
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With