New Emacs user here. Hitting enter after a semicolon commented line in any file type (.el and .lisp at the very least) indents the comment in a very unhelpful way that I have to assume is not intended behavior. This problem does not occur if I move away from that comment line in any way besides hitting return (triggering auto-indent presumably).

For example, If I type the following

; this is a comment

Then hit return, I get the following (32 spaces indentation)

                                ; this is a comment

What is causing this behavior, and how can I prevent it?

I am running Emacs installed through Chocolatey on Windows 10

  • 1
    Use two semicolons.
    – NickD
    Commented Jul 22, 2020 at 19:24

1 Answer 1


Unable to post this as a comment, but the indentation is likely part of one of the active modes (probably lisp-mode based on your description). You can do M+x describe-modes to see which modes are active.

This answer provides some background on the history of the common lisp commenting style https://stackoverflow.com/a/6365579

This question and answers describe why the single ; indents differently than multiple consecutive ; characters: https://stackoverflow.com/questions/14190488/set-comments-at-the-same-indentation-level-as-all-forms, namely that lisp-indent-line hardcodes it with the following comment

          ;; Single-semicolon comment lines should be indented
          ;; as comment lines, not as code.

Your Answer

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

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