《 Emacs Lisp参考手册》的附录D.7提到了一些注释提示:
;
内嵌注释应使用单分号()。;;
行注释应使用双分号()。- 三元分号(
;;;
)应该用于“应将其视为大纲次要模式的标题的注释”。 ;;;;
程序的主要部分的标题应使用四分号()。
单分号和双分号的用例很明确,但在三分号和四分号之间似乎没有清晰的界限。
特别是,由Emacs提供的Emacs软件包的标准文档auto-insert
使用了三分号,从不四分号,即使对于最高级别的标题,例如文件名和主要部分。请参见下面的示例:
;;; test.el --- A test file. -*- lexical-binding: t; -*-
;; Copyright (C) 2016
;; Author: John Smith
;; Keywords:
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;;
;;; Code:
(provide 'test)
;;; test.el ends here
三重和四重分号的最佳做法是什么?
更新资料
感谢Stefan的回答,我提交了一个错误报告并提出以下建议:
我建议将三个分号的描述更改为:
Comments that start with three semicolons, ‘;;;’, are considered top-level headings by Outline minor mode. Four or more semicolons can be used as subheadings in hierarchical fashion. E.g. ;;; Main heading ;;;; Sub heading ;;;;; Sub sub heading ;;;; Another sub heading ;;; Next main heading These comments should be used to break Emacs Lisp code into sections.
Emacs手册中的“大纲次要模式”链接将很有用:https : //www.gnu.org/software/emacs/manual/html_node/emacs/Outline-Mode.html
可以省略用于四个分号的部分。
@sds导致了;;;的一些非标准应用程序 ;)
—
泰勒(Tyler
这就是我的意思-OTOH,这4个分号的建议不能太当真,还应该查看文件时间戳-这些非标准的东西可能已经过时了。
—
2016年
grep -r '^;;;; ' lisp
)中寻找灵感。