Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 357
justinhj Avatar asked Dec 25 '10 21:12

justinhj


1 Answers

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
like image 129
koddo Avatar answered Nov 18 '22 10:11

koddo