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

jus*_*nhj 14 emacs tabs clojure

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

例如,只需打开一个clojure文件,输入; 在第一个字符和按选项卡.

我使用的是1.7.1版本

kod*_*ddo 27

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


来自Peter Norvig的Good Lisp编程风格教程(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
Run Code Online (Sandbox Code Playgroud)

  • 哦! 这很公平.我的Common Lisp模式从未强制执行过,但我想我应该养成更好的习惯.+1表示该书的链接 (4认同)
  • @pauldoo你用可变宽度字体编码?那一定很糟糕. (3认同)