gpt4 book ai didi

emacs - 将注释设置为与所有表单相同的缩进级别

转载 作者:行者123 更新时间:2023-12-04 02:02:52 25 4
gpt4 key购买 nike

默认情况下,注释的缩进级别对我来说似乎很陌生。

(defun example ()
just
some
; a comment
words)

如何调整它使第一个分号与常规 Lisp 形式垂直对齐?
(defun example ()
just
some
; a comment
words)

我能发现的是,默认机制的工作原理是将注释与固定列对齐(可通过 M-x comment-set-column 查询),并且可以修改 comment-indent-function变量(将其设置为 nil 部分解决了我的问题)。

最佳答案

Emacs 根据使用的分号数量对 elisp 中的注释进行不同的缩进。如果你使用两个,你应该得到你想要的缩进:

(defun test-single ()
; A single semicolon
nil)

(defun test-double ()
;; Do two semicolons make a colon ;)
nil)

另外,三个分号 ;;;根本没有重新缩进。通常,它们用于标记源文件中的新主要部分。

关于emacs - 将注释设置为与所有表单相同的缩进级别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14190488/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com