Skip to content

Commit cf1841c

Browse files
Update the Common Lisp Style Guide to 1.28.
1 parent a5eb0c5 commit cf1841c

File tree

1 file changed

+57
-27
lines changed

1 file changed

+57
-27
lines changed

lispguide.xml

+57-27
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
<p align="right">
77

8-
Revision 1.23
8+
Revision 1.28
99
</p>
1010

1111

@@ -665,16 +665,35 @@ Robert Brown
665665
<p>
666666
Indent your code the way a properly configured GNU Emacs does.
667667
</p>
668+
<p>
669+
Maintain a consistent indentation style throughout a project.
670+
</p>
668671
<p>
669672
Indent carefully to make the code easier to understand.
670673
</p>
671674
</SUMMARY>
672675
<BODY>
673676
<p>
674-
By default, GNU Emacs does an excellent job indenting Common Lisp code.
675-
It can be taught how to indent new defining forms
676-
and special rules for domain specific languages.
677-
Each project may have some file to customize indentation; use it.
677+
Common Lisp indentation in Emacs is provided by the cl-indent library.
678+
The latest version of cl-indent is packaged with
679+
<a HREF="http://www.common-lisp.net/project/slime/">SLIME</a>
680+
(under contrib/slime-cl-indent.el). After installing SLIME, set up Emacs
681+
to load SLIME automatically using
682+
<a HREF="http://www.common-lisp.net/project/slime/doc/html/Loading-Contribs.html">these instructions</a>, adding slime-indentation to the list of
683+
contrib libraries to be loaded in the call to slime-setup.
684+
</p>
685+
<p>
686+
Ideally, use the default indentation settings provided by
687+
slime-indentation. If necessary, customize indentation parameters to
688+
maintain a consistent indentation style throughout an existing project.
689+
Parameters can be customized using the :variables setting in
690+
define-common-lisp-style. Indentation of specific forms can be
691+
customized using the :indentation setting of define-common-lisp-style.
692+
This is particularly useful when creating forms that behave like macros
693+
or special operators that are indented differently than standard
694+
function calls (e.g. defun, labels, or let). Add a
695+
<a HREF="http://www.gnu.org/software/emacs/manual/html_node/emacs/Hooks.html">hook</a> to 'lisp-mode-hook that calls common-lisp-set-style to set
696+
the appropriate style automatically.
678697
</p>
679698

680699

@@ -728,27 +747,25 @@ Robert Brown
728747
that is not covered by an <code>ASDF</code> <code>:around-compile</code> hook.
729748
</p>
730749
<CODE_SNIPPET>
731-
;;;; Author: brown (Robert Brown)
732-
733750
;;;; Variable length encoding for integers and floating point numbers.
734751

735752
(in-package #:varint)
736753
(declaim #.*optimize-default*)
737754
</CODE_SNIPPET>
738755
<p>
739-
You should not include authorship information at the top of a file,
740-
that information is available from version control and
741-
<code>OWNERS</code>.
756+
You should not include authorship information at the top of a file:
757+
better information is available from version control,
758+
and such a mention will only cause confusion and grief.
759+
Indeed, whoever was the main author at the time such a mention was included
760+
might not be who eventually made the most significant contributions to the file,
761+
and even less who is responsible for the file at the moment.
762+
742763
</p>
743764
<p>
744765
You should not include copyright information in individual source code files.
745766
An exception is made for files meant to be disseminated as standalone.
746767
</p>
747-
<p>
748-
Each project or library has a single file specifying its license.
749-
Absence of a <tt>LICENSE</tt> or <tt>COPYING</tt> file
750-
means the project is proprietary code.
751-
</p>
768+
752769

753770
</BODY>
754771
</STYLEPOINT>
@@ -1109,12 +1126,19 @@ Robert Brown
11091126
</p>
11101127
<p>
11111128
The comments begin with <code>TODO</code> in all capital letters,
1112-
followed by your email address or other identifier in parentheses,
1113-
followed by a colon, a space, and
1114-
an explanation of what additional work is desirable or required.
1115-
The user name included in the comment is that
1116-
of a person who understands the deficiency.
1117-
A TODO comment is not a commitment to fix the problem.
1129+
followed by the
1130+
1131+
name, e-mail address, or other identifier
1132+
of the person
1133+
with the best context about the problem referenced by the <code>TODO</code>.
1134+
The main purpose is to have a consistent <code>TODO</code> that
1135+
can be searched to find out how to get more details upon
1136+
request. A <code>TODO</code> is not a commitment that the
1137+
person referenced will fix the problem. Thus when you create
1138+
a <code>TODO</code>,
1139+
it is almost always your
1140+
name
1141+
that is given.
11181142
</p>
11191143
<p>
11201144
When signing comments,
@@ -1128,10 +1152,13 @@ Robert Brown
11281152
</CODE_SNIPPET>
11291153
<p>
11301154
Be specific when indicating times or software releases
1131-
in a TODO comment:
1155+
in a TODO comment and use
1156+
<a HREF="http://www.w3.org/TR/NOTE-datetime">YYYY-MM-DD</a>
1157+
format for dates to make automated processing of such dates easier,
1158+
e.g., 2038-01-20 for the end of the 32-bit signed <code>time_t</code>.
11321159
</p>
11331160
<CODE_SNIPPET>
1134-
;;--- TODO(brown): Remove this code after release 1.7 or before November, 2012.
1161+
;;--- TODO(brown): Remove this code after release 1.7 or before 2012-11-30.
11351162
</CODE_SNIPPET>
11361163
<p>
11371164
For code that uses unobvious forms to accomplish a task, you must include a comment
@@ -3674,7 +3701,7 @@ Robert Brown
36743701
which matters a lot on non-Unix platforms
36753702
(and even on some Unix implementations).
36763703
You probably should be using
3677-
<code>UIOP:MERGE-PATHNAMES*</code>
3704+
<code>UIOP:MERGE-PATHNAMES*</code> or <code>UIOP:SUBPATHNAME</code>
36783705
instead of <code>MERGE-PATHNAMES</code>,
36793706
especially if your expectations for relative pathnames
36803707
are informed by the way they work in Unix or Windows;
@@ -3690,7 +3717,10 @@ Robert Brown
36903717
is not portable across implementations
36913718
in how it handles wildcards, sub-directories, symlinks, etc.
36923719
There again, <code>UIOP</code> provides several
3693-
common abstractions to deal with pathnames.
3720+
common abstractions to deal with pathnames,
3721+
but only does so good a job.
3722+
For a complete portable solution, use IOLib —
3723+
though its Windows support lags behind.
36943724
</p>
36953725
<p>
36963726
<code>LOGICAL-PATHNAME</code>s are not a portable abstraction,
@@ -3716,7 +3746,7 @@ Robert Brown
37163746
to forget irrelevant build-time paths and
37173747
reinitialize any search path from current environment variables.
37183748
<code>ASDF</code> for instance requires you to reset its paths
3719-
with <code>ASDF:CLEAR-CONFIGURATION</code>.
3749+
with <code>UIOP:CLEAR-CONFIGURATION</code>.
37203750
<code>UIOP</code> provides hooks
37213751
to call functions before an image is dumped,
37223752
from which to reset or <code>makunbound</code> relevant variables.
@@ -3840,7 +3870,7 @@ Robert Brown
38403870
</small>
38413871

38423872
<p align="right">
3843-
Revision 1.23
3873+
Revision 1.28
38443874
</p>
38453875

38463876

0 commit comments

Comments
 (0)