emacs - clojure 模式下的注释缩进似乎很困惑

标签 emacs clojure tabs

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

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

我使用的是 1.7.1 版

最佳答案

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

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

Obey comment conventions:

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


这些注释提示是为 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

关于emacs - clojure 模式下的注释缩进似乎很困惑,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4531761/

相关文章:

shell - 自定义 shell 自动从 .emacs 启动

emacs - 围绕命令行程序构建 emacs 包装模式的秘诀?

javascript - Yii2 选项卡小部件设置为事件后未更改状态

删除 mysql 数据的 Javascript 警报在新选项卡中打开

php - 如何在评论选项卡下方移动 Woocommerce 描述选项卡

linux - 将 Emacs 从 Linux 迁移到 Windows

emacs - 在 Emacs 中,如何摆脱 "possible archaic use of (hi-lock-mode)"错误?

macros - 如何处理来自 Clojurescript 宏所需的 Clojurescript 代码?

maven - 使用 maven-release-plugin 将额外的 jar 部署到存储库

clojure - Lein uberjar 在简单的 '-main' 用法上失败,但也许我不明白它在做什么?