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