2

It seems that whenever I press RET on my emacs init.el file comment lines that the previous line just randomly indents ~4 tabs. I only have a simple load path (nothing currently in there really except for load path and load org-mode).

Nothing happens when I press C-j in this position, only RET.

I am on Mac OS X 10.10, iTerm 2 using xterm-256color but I launch emacs -nw with TERM=xterm-16color because that is the only way that my colors work correctly.

Before RET

After RET

Any ideas of where I should be looking to solve this problem?

  • Does it only indent comments or does it affect lisp code as well? At first guess I'd suspect an open sexp higher up that would indent to there. – Jonathan Leech-Pepin Sep 15 '15 at 22:27
  • Can you show what Enabled minor modes are active from the output of the command C-h m – Emacs User Sep 15 '15 at 22:50
5

Use ;; (or more) instead of ; and this won't happen.

What you're seeing is (in conjunction with electric-indent-mode) expected behaviour, as by convention

Comments that start with a single semicolon, ‘;’, should all be aligned to the same column on the right of the source code. Such comments usually explain how the code on that line does its job.

See C-hig (elisp) Comment Tips RET

The comment-column variable determines the level of indentation for this style of comment.

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.