diff options
| author | Chong Yidong | 2012-02-15 12:00:34 +0800 |
|---|---|---|
| committer | Chong Yidong | 2012-02-15 12:00:34 +0800 |
| commit | c3a70e2b95e4cf41b1a671f7d721f0ba4aaff679 (patch) | |
| tree | e1632789ac2c8118ccac24691c4a91fe57109c55 | |
| parent | 9f26dc243268eddc252287ef1918970bf580e946 (diff) | |
| download | emacs-c3a70e2b95e4cf41b1a671f7d721f0ba4aaff679.tar.gz emacs-c3a70e2b95e4cf41b1a671f7d721f0ba4aaff679.zip | |
Doc updates for defvar, defconst, and defcustom.
* lisp/custom.el (defcustom): Doc fix; note use of defvar.
* src/eval.c (Fdefvar, Fdefconst): Doc fix; note that the variable is
marked as special. Also, starting docstrings with * is obsolete.
| -rw-r--r-- | lisp/ChangeLog | 4 | ||||
| -rw-r--r-- | lisp/custom.el | 6 | ||||
| -rw-r--r-- | src/ChangeLog | 5 | ||||
| -rw-r--r-- | src/eval.c | 49 |
4 files changed, 43 insertions, 21 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index a3b5a4d9486..6ec2cd2f038 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | 2012-02-15 Chong Yidong <cyd@gnu.org> | ||
| 2 | |||
| 3 | * custom.el (defcustom): Doc fix; note use of defvar. | ||
| 4 | |||
| 1 | 2012-02-15 Glenn Morris <rgm@gnu.org> | 5 | 2012-02-15 Glenn Morris <rgm@gnu.org> |
| 2 | 6 | ||
| 3 | * mail/smtpmail.el (smtpmail-smtp-user, smtpmail-stream-type): | 7 | * mail/smtpmail.el (smtpmail-smtp-user, smtpmail-stream-type): |
diff --git a/lisp/custom.el b/lisp/custom.el index 2d880d23955..810b78144a4 100644 --- a/lisp/custom.el +++ b/lisp/custom.el | |||
| @@ -208,7 +208,11 @@ is unbound. The expression itself is also stored, so that | |||
| 208 | Customize can re-evaluate it later to get the standard value. | 208 | Customize can re-evaluate it later to get the standard value. |
| 209 | DOC is the variable documentation. | 209 | DOC is the variable documentation. |
| 210 | 210 | ||
| 211 | The remaining arguments should have the form | 211 | This macro uses `defvar' as a subroutine, which also marks the |
| 212 | variable as \"special\", so that it is always dynamically bound | ||
| 213 | even when `lexical-binding' is t. | ||
| 214 | |||
| 215 | The remaining arguments to `defcustom' should have the form | ||
| 212 | 216 | ||
| 213 | [KEYWORD VALUE]... | 217 | [KEYWORD VALUE]... |
| 214 | 218 | ||
diff --git a/src/ChangeLog b/src/ChangeLog index 7893cd68396..4375ffef3d7 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2012-02-15 Chong Yidong <cyd@gnu.org> | ||
| 2 | |||
| 3 | * eval.c (Fdefvar, Fdefconst): Doc fix; note that the variable is | ||
| 4 | marked as special. Also, starting docstrings with * is obsolete. | ||
| 5 | |||
| 1 | 2012-02-13 Andreas Schwab <schwab@linux-m68k.org> | 6 | 2012-02-13 Andreas Schwab <schwab@linux-m68k.org> |
| 2 | 7 | ||
| 3 | * gnutls.c (emacs_gnutls_write): Fix last change. | 8 | * gnutls.c (emacs_gnutls_write): Fix last change. |
diff --git a/src/eval.c b/src/eval.c index dbd06e7c1b1..344228741cb 100644 --- a/src/eval.c +++ b/src/eval.c | |||
| @@ -780,17 +780,15 @@ The return value is BASE-VARIABLE. */) | |||
| 780 | 780 | ||
| 781 | DEFUN ("defvar", Fdefvar, Sdefvar, 1, UNEVALLED, 0, | 781 | DEFUN ("defvar", Fdefvar, Sdefvar, 1, UNEVALLED, 0, |
| 782 | doc: /* Define SYMBOL as a variable, and return SYMBOL. | 782 | doc: /* Define SYMBOL as a variable, and return SYMBOL. |
| 783 | You are not required to define a variable in order to use it, | 783 | You are not required to define a variable in order to use it, but |
| 784 | but the definition can supply documentation and an initial value | 784 | defining it lets you supply an initial value and documentation, which |
| 785 | in a way that tags can recognize. | 785 | can be referred to by the Emacs help facilities and other programming |
| 786 | 786 | tools. The `defvar' form also declares the variable as \"special\", | |
| 787 | INITVALUE is evaluated, and used to set SYMBOL, only if SYMBOL's value is void. | 787 | so that it is always dynamically bound even if `lexical-binding' is t. |
| 788 | If SYMBOL is buffer-local, its default value is what is set; | 788 | |
| 789 | buffer-local values are not affected. | 789 | The optional argument INITVALUE is evaluated, and used to set SYMBOL, |
| 790 | INITVALUE and DOCSTRING are optional. | 790 | only if SYMBOL's value is void. If SYMBOL is buffer-local, its |
| 791 | If DOCSTRING starts with *, this variable is identified as a user option. | 791 | default value is what is set; buffer-local values are not affected. |
| 792 | This means that M-x set-variable recognizes it. | ||
| 793 | See also `user-variable-p'. | ||
| 794 | If INITVALUE is missing, SYMBOL's value is not set. | 792 | If INITVALUE is missing, SYMBOL's value is not set. |
| 795 | 793 | ||
| 796 | If SYMBOL has a local binding, then this form affects the local | 794 | If SYMBOL has a local binding, then this form affects the local |
| @@ -799,6 +797,13 @@ load a file defining variables, with this form or with `defconst' or | |||
| 799 | `defcustom', you should always load that file _outside_ any bindings | 797 | `defcustom', you should always load that file _outside_ any bindings |
| 800 | for these variables. \(`defconst' and `defcustom' behave similarly in | 798 | for these variables. \(`defconst' and `defcustom' behave similarly in |
| 801 | this respect.) | 799 | this respect.) |
| 800 | |||
| 801 | The optional argument DOCSTRING is a documentation string for the | ||
| 802 | variable. | ||
| 803 | |||
| 804 | To define a user option, use `defcustom' instead of `defvar'. | ||
| 805 | The function `user-variable-p' also identifies a variable as a user | ||
| 806 | option if its DOCSTRING starts with *, but this behavior is obsolete. | ||
| 802 | usage: (defvar SYMBOL &optional INITVALUE DOCSTRING) */) | 807 | usage: (defvar SYMBOL &optional INITVALUE DOCSTRING) */) |
| 803 | (Lisp_Object args) | 808 | (Lisp_Object args) |
| 804 | { | 809 | { |
| @@ -873,15 +878,19 @@ usage: (defvar SYMBOL &optional INITVALUE DOCSTRING) */) | |||
| 873 | 878 | ||
| 874 | DEFUN ("defconst", Fdefconst, Sdefconst, 2, UNEVALLED, 0, | 879 | DEFUN ("defconst", Fdefconst, Sdefconst, 2, UNEVALLED, 0, |
| 875 | doc: /* Define SYMBOL as a constant variable. | 880 | doc: /* Define SYMBOL as a constant variable. |
| 876 | The intent is that neither programs nor users should ever change this value. | 881 | This declares that neither programs nor users should ever change the |
| 877 | Always sets the value of SYMBOL to the result of evalling INITVALUE. | 882 | value. This constancy is not actually enforced by Emacs Lisp, but |
| 878 | If SYMBOL is buffer-local, its default value is what is set; | 883 | SYMBOL is marked as a special variable so that it is never lexically |
| 879 | buffer-local values are not affected. | 884 | bound. |
| 880 | DOCSTRING is optional. | 885 | |
| 881 | 886 | The `defconst' form always sets the value of SYMBOL to the result of | |
| 882 | If SYMBOL has a local binding, then this form sets the local binding's | 887 | evalling INITVALUE. If SYMBOL is buffer-local, its default value is |
| 883 | value. However, you should normally not make local bindings for | 888 | what is set; buffer-local values are not affected. If SYMBOL has a |
| 884 | variables defined with this form. | 889 | local binding, then this form sets the local binding's value. |
| 890 | However, you should normally not make local bindings for variables | ||
| 891 | defined with this form. | ||
| 892 | |||
| 893 | The optional DOCSTRING specifies the variable's documentation string. | ||
| 885 | usage: (defconst SYMBOL INITVALUE [DOCSTRING]) */) | 894 | usage: (defconst SYMBOL INITVALUE [DOCSTRING]) */) |
| 886 | (Lisp_Object args) | 895 | (Lisp_Object args) |
| 887 | { | 896 | { |