aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2007-05-04 13:17:20 +0000
committerEli Zaretskii2007-05-04 13:17:20 +0000
commit20320eebf29c135617e0b064f2180cc8fe57b982 (patch)
tree9a131440ded31b5308e5136f88ace2e0bb6284c4
parent1a12af30ce0b522aa8c7efb6143b5692007d38b8 (diff)
downloademacs-20320eebf29c135617e0b064f2180cc8fe57b982.tar.gz
emacs-20320eebf29c135617e0b064f2180cc8fe57b982.zip
(Documentation Tips): Rearrange items to place the more important ones first.
Add an index entry for hyperlinks.
-rw-r--r--lispref/ChangeLog5
-rw-r--r--lispref/tips.texi145
2 files changed, 78 insertions, 72 deletions
diff --git a/lispref/ChangeLog b/lispref/ChangeLog
index da308a7fa41..5def92daa6f 100644
--- a/lispref/ChangeLog
+++ b/lispref/ChangeLog
@@ -1,3 +1,8 @@
12007-05-04 Eli Zaretskii <eliz@gnu.org>
2
3 * tips.texi (Documentation Tips): Rearrange items to place the
4 more important ones first. Add an index entry for hyperlinks.
5
12007-05-03 Karl Berry <karl@gnu.org> 62007-05-03 Karl Berry <karl@gnu.org>
2 7
3 * elisp.texi (\urlcolor, \linkcolor) [smallbook]: \Black for printing. 8 * elisp.texi (\urlcolor, \linkcolor) [smallbook]: \Black for printing.
diff --git a/lispref/tips.texi b/lispref/tips.texi
index ee8caf4953b..254e1faf7ff 100644
--- a/lispref/tips.texi
+++ b/lispref/tips.texi
@@ -648,75 +648,18 @@ you need to explain the details of how to use the function or
648variable. Please use complete sentences for the rest of the text too. 648variable. Please use complete sentences for the rest of the text too.
649 649
650@item 650@item
651The first line should mention all the important arguments of the
652function, and should mention them in the order that they are written
653in a function call. If the function has many arguments, then it is
654not feasible to mention them all in the first line; in that case, the
655first line should mention the first few arguments, including the most
656important arguments.
657
658@item
659For consistency, phrase the verb in the first sentence of a function's
660documentation string as an imperative---for instance, use ``Return the
661cons of A and B.'' in preference to ``Returns the cons of A and B@.''
662Usually it looks good to do likewise for the rest of the first
663paragraph. Subsequent paragraphs usually look better if each sentence
664is indicative and has a proper subject.
665
666@item
667Write documentation strings in the active voice, not the passive, and in
668the present tense, not the future. For instance, use ``Return a list
669containing A and B.'' instead of ``A list containing A and B will be
670returned.''
671
672@item
673Avoid using the word ``cause'' (or its equivalents) unnecessarily.
674Instead of, ``Cause Emacs to display text in boldface,'' write just
675``Display text in boldface.''
676
677@item
678When a command is meaningful only in a certain mode or situation,
679do mention that in the documentation string. For example,
680the documentation of @code{dired-find-file} is:
681
682@example
683In Dired, visit the file or directory named on this line.
684@end example
685
686@item
687Do not start or end a documentation string with whitespace.
688
689@item
690@strong{Do not} indent subsequent lines of a documentation string so
691that the text is lined up in the source code with the text of the first
692line. This looks nice in the source code, but looks bizarre when users
693view the documentation. Remember that the indentation before the
694starting double-quote is not part of the string!
695
696@item
697When the user tries to use a disabled command, Emacs displays just the 651When the user tries to use a disabled command, Emacs displays just the
698first paragraph of its documentation string---everything through the 652first paragraph of its documentation string---everything through the
699first blank line. If you wish, you can choose which information to 653first blank line. If you wish, you can choose which information to
700include before the first blank line so as to make this display useful. 654include before the first blank line so as to make this display useful.
701 655
702@item 656@item
703When you define a variable that users ought to set interactively, you 657The first line should mention all the important arguments of the
704normally should use @code{defcustom}. However, if for some reason you 658function, and should mention them in the order that they are written
705use @code{defvar} instead, start the doc string with a @samp{*}. 659in a function call. If the function has many arguments, then it is
706@xref{Defining Variables}. 660not feasible to mention them all in the first line; in that case, the
707 661first line should mention the first few arguments, including the most
708@item 662important arguments.
709The documentation string for a variable that is a yes-or-no flag should
710start with words such as ``Non-nil means,'' to make it clear that
711all non-@code{nil} values are equivalent and indicate explicitly what
712@code{nil} and non-@code{nil} mean.
713
714@item
715The documentation string for a function that is a yes-or-no predicate
716should start with words such as ``Return t if,'' to indicate
717explicitly what constitutes ``truth.'' The word ``return'' avoids
718starting the sentence with lower-case ``t,'' which could be somewhat
719distracting.
720 663
721@item 664@item
722When a function's documentation string mentions the value of an argument 665When a function's documentation string mentions the value of an argument
@@ -754,16 +697,14 @@ and that annoys you, rewrite the sentence so that the symbol
754is not at the start of it. 697is not at the start of it.
755 698
756@item 699@item
757If a line in a documentation string begins with an open-parenthesis, 700Do not start or end a documentation string with whitespace.
758write a backslash before the open-parenthesis, like this:
759
760@example
761The argument FOO can be either a number
762\(a buffer position) or a string (a file name).
763@end example
764 701
765This prevents the open-parenthesis from being treated as the start of a 702@item
766defun (@pxref{Defuns,, Defuns, emacs, The GNU Emacs Manual}). 703@strong{Do not} indent subsequent lines of a documentation string so
704that the text is lined up in the source code with the text of the first
705line. This looks nice in the source code, but looks bizarre when users
706view the documentation. Remember that the indentation before the
707starting double-quote is not part of the string!
767 708
768@anchor{Docstring hyperlinks} 709@anchor{Docstring hyperlinks}
769@item 710@item
@@ -781,6 +722,7 @@ t and nil without single-quotes. (In this manual, we use a different
781convention, with single-quotes for all symbols.) 722convention, with single-quotes for all symbols.)
782@end ifnottex 723@end ifnottex
783 724
725@cindex hyperlinks in documentation strings
784Help mode automatically creates a hyperlink when a documentation string 726Help mode automatically creates a hyperlink when a documentation string
785uses a symbol name inside single quotes, if the symbol has either a 727uses a symbol name inside single quotes, if the symbol has either a
786function or a variable definition. You do not need to do anything 728function or a variable definition. You do not need to do anything
@@ -863,6 +805,65 @@ It is not practical to use @samp{\\[@dots{}]} very many times, because
863display of the documentation string will become slow. So use this to 805display of the documentation string will become slow. So use this to
864describe the most important commands in your major mode, and then use 806describe the most important commands in your major mode, and then use
865@samp{\\@{@dots{}@}} to display the rest of the mode's keymap. 807@samp{\\@{@dots{}@}} to display the rest of the mode's keymap.
808
809@item
810For consistency, phrase the verb in the first sentence of a function's
811documentation string as an imperative---for instance, use ``Return the
812cons of A and B.'' in preference to ``Returns the cons of A and B@.''
813Usually it looks good to do likewise for the rest of the first
814paragraph. Subsequent paragraphs usually look better if each sentence
815is indicative and has a proper subject.
816
817@item
818The documentation string for a function that is a yes-or-no predicate
819should start with words such as ``Return t if,'' to indicate
820explicitly what constitutes ``truth.'' The word ``return'' avoids
821starting the sentence with lower-case ``t,'' which could be somewhat
822distracting.
823
824@item
825If a line in a documentation string begins with an open-parenthesis,
826write a backslash before the open-parenthesis, like this:
827
828@example
829The argument FOO can be either a number
830\(a buffer position) or a string (a file name).
831@end example
832
833This prevents the open-parenthesis from being treated as the start of a
834defun (@pxref{Defuns,, Defuns, emacs, The GNU Emacs Manual}).
835
836@item
837Write documentation strings in the active voice, not the passive, and in
838the present tense, not the future. For instance, use ``Return a list
839containing A and B.'' instead of ``A list containing A and B will be
840returned.''
841
842@item
843Avoid using the word ``cause'' (or its equivalents) unnecessarily.
844Instead of, ``Cause Emacs to display text in boldface,'' write just
845``Display text in boldface.''
846
847@item
848When a command is meaningful only in a certain mode or situation,
849do mention that in the documentation string. For example,
850the documentation of @code{dired-find-file} is:
851
852@example
853In Dired, visit the file or directory named on this line.
854@end example
855
856@item
857When you define a variable that users ought to set interactively, you
858normally should use @code{defcustom}. However, if for some reason you
859use @code{defvar} instead, start the doc string with a @samp{*}.
860@xref{Defining Variables}.
861
862@item
863The documentation string for a variable that is a yes-or-no flag should
864start with words such as ``Non-nil means,'' to make it clear that
865all non-@code{nil} values are equivalent and indicate explicitly what
866@code{nil} and non-@code{nil} mean.
866@end itemize 867@end itemize
867 868
868@node Comment Tips 869@node Comment Tips