I am using Emacs, Paredit, Slime to work on Common Lisp (SBCL). When I create a comment such as:

; test 

It is placed as expected. But if I press return in order to create a new line below ;test this happens:

                                        ; test

A bunch of whitespaces suddenly appear.

Why is this happening?

How can I avoid it?


1 Answer 1


Lisp has a more complex convention for comments than most languages, and automatic formatting respects this convention. It is documented in appendix D.7 Tips on Writing Comments of the Elisp manual (which is also available inside of Emacs itself, use C-h i to open the Info viewer).

In a nutshell, comments that start with just a ; are formatted like marginal notes in a book; they go at the ends of the lines where the right–hand margin would be. Use ;; for comments that are meant to be indented in a way similar to code; this puts the comments at the left–hand margin when they’re not inside a function or other type of top–level item. You can use ;;; and ;;;; for headings to divide your documentation or code up into sections and chapters.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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