【发布时间】:2011-05-30 17:26:29
【问题描述】:
在 clojure-mode 中,emacs 将我的半冒号 cmets 缩进 5 个制表符。即使它是空文件中的第一行,也会发生这种情况。
例如,打开一个 clojure 文件,输入 ;在第一个字符处,然后按 Tab。
我使用的是 1.7.1 版
【问题讨论】:
在 clojure-mode 中,emacs 将我的半冒号 cmets 缩进 5 个制表符。即使它是空文件中的第一行,也会发生这种情况。
例如,打开一个 clojure 文件,输入 ;在第一个字符处,然后按 Tab。
我使用的是 1.7.1 版
【问题讨论】:
这是正常行为。在您的情况下,您需要两个分号 (;;)。
来自Good Lisp Programming Style by Peter Norvig (pdf) 上的教程——第 41 页:
遵守评论约定:
- ;用于内联评论
- ;;功能内评论
- ;;;函数间注释
- ;;;;用于节标题(用于大纲模式)
这些注释提示是为 emacs lisp 编写的,但它们对所有 lisp 都是一样的: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
【讨论】: