justinhj
justinhj

Reputation: 11306

Comment indenting seems messed up in clojure-mode

In clojure-mode emacs is indenting my semi colon comments with 5 tabs. Even if it is the first line in an empty file this occurs.

Eg just open up a clojure file, enter ; at the first character and press tab.

I'm using version 1.7.1

Upvotes: 14

Views: 1900

Answers (1)

koddo
koddo

Reputation: 3408

That's normal behavior. In your case you want two semicolons (;;).


From Tutorial on Good Lisp Programming Style by Peter Norvig (pdf) -- page 41:

Obey comment conventions:

  • ; for inline comment
  • ;; for in-function comment
  • ;;; for between-function comment
  • ;;;; for section header (for outline mode)

These comment tips are written for emacs lisp, but they are the same for all lisps: http://www.gnu.org/s/emacs/manual/html_node/elisp/Comment-Tips.html

(setq base-version-list                           ; there was a base
                (assoc (substring fn 0 start-vn)  ; version to which
                       file-version-assoc-list))  ; this looks like
                                                  ; a subversion
                                                  ;
                                                  ;
                                                  ;
                                                  ;    again, 
                                                  ;    this is inline comment


;; two semicolon comment
;; aligned to the same level of indentation as the code

Upvotes: 29

Related Questions