在emacs模式下定义多行注释的正确方法是什么
(例如C的/* */)?我看到的elisp示例用于注释,该注释以单个定界符开始,并在行的结尾处结束(例如C++的//或perl的#)。
最佳答案
就像这样:
(define-derived-mode my-mode
awk-mode "my"
"My mode"
(setq comment-multi-line nil) ; maybe
(setq comment-start "/* ")
(setq comment-end "*/"))
但是有一些微妙之处。也许你想要
/* line one */
/* line two */
/* line three */
也许你想要
/*
line one
line two
line three
*/
这受您的
comment-style
影响,您可以对其进行自定义(M-x customize-variable comment-style
)。对于第一个示例,请选择indent
,对于第二个示例,请选择extra-line
。所有这些都在
newcomment.el
中定义,如果您使用M-x describe-variable comment-start
,则可以阅读。
关于Emacs模式多行注释,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/499206/