0

I am using Slime, Paredit, and SBCL to code in Common Lisp. While editing a .lisp file, suppose I have this code:

(dotimes (i 4))

I will represent the cursor (point) as -!-. Having the cursor in this position and pressing return key I get:

(dotimes (i 4) -!-)

;;; press `return`

(dotime (i 4) 
      -!-)

I would like to have the same in the SLIME Repl. There, if I have:

CL-USER> (dotimes (i 4)-!-)

;; after pressing `return` the expression is evalued

NIL

I can use C-o. However, C-o gives a new line but with no indentation, such as:

CL-USER> CL-USER> (dotimes (i 4)-!-)

;; after pressing `C-o`, I have:

CL-USER> CL-USER> (dotimes (i 4)
-!-)

Is there a way to get a new line but with a properly indented parenthesis? Another command maybe? Should I insert something on my init files?

Thanks

2

C-j runs slime-repl-newline-and-indent which I think will work. Whenever I'm faced with an unfamiliar mode, I do C-h m which shows me mode information, including the keymaps: I can then zero in on the relevant function(s). That's how I found this.

The doc string of slime-repl-newline-and-indent says:

Insert a newline, then indent the next line. Restrict the buffer from the prompt for indentation, to avoid being confused by strange characters (like unmatched quotes) appearing earlier in the buffer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.