注释缩进似乎在clojure模式中搞砸了

时间:2010-12-25 21:35:08

标签: emacs clojure tabs

在clojure模式中,emacs用5个标签缩进我的半冒号注释。即使它是空文件中的第一行,也会发生这种情况。

例如,只需打开一个clojure文件,输入;在第一个字符和按Tab键。

我正在使用1.7.1版

1 个答案:

答案 0 :(得分:27)

这是正常行为。在您的情况下,您需要两个分号(;;)。


来自Good Lisp Programming Style by Peter Norvig (pdf)的教程 - 第41页:

  

遵守评论惯例:

     
      
  • ;内联评论
  •   
  • ;;用于功能评论
  •   
  • ;;;用于功能间评论
  •   
  • ;;;;用于节标题(用于大纲模式)
  •   

这些评论提示是针对emacs lisp编写的,但它们对于所有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
相关问题