diff options
| author | Paul Eggert | 2012-02-24 22:41:40 -0800 |
|---|---|---|
| committer | Paul Eggert | 2012-02-24 22:41:40 -0800 |
| commit | a89654f8f34114db543cb91363e8fded6d73e986 (patch) | |
| tree | 5ac508597ef2aa460308b4b26c244779e48cdb40 /src/eval.c | |
| parent | 6e6c82a4e687708d5a7a3887f92db45bd74da276 (diff) | |
| parent | 67b0de11479247cb8bd8491e10e0b464046f18be (diff) | |
| download | emacs-a89654f8f34114db543cb91363e8fded6d73e986.tar.gz emacs-a89654f8f34114db543cb91363e8fded6d73e986.zip | |
Merge from trunk.
Diffstat (limited to 'src/eval.c')
| -rw-r--r-- | src/eval.c | 49 |
1 files changed, 29 insertions, 20 deletions
diff --git a/src/eval.c b/src/eval.c index ed3c811f28a..7f3bf6a866f 100644 --- a/src/eval.c +++ b/src/eval.c | |||
| @@ -752,17 +752,15 @@ The return value is BASE-VARIABLE. */) | |||
| 752 | 752 | ||
| 753 | DEFUN ("defvar", Fdefvar, Sdefvar, 1, UNEVALLED, 0, | 753 | DEFUN ("defvar", Fdefvar, Sdefvar, 1, UNEVALLED, 0, |
| 754 | doc: /* Define SYMBOL as a variable, and return SYMBOL. | 754 | doc: /* Define SYMBOL as a variable, and return SYMBOL. |
| 755 | You are not required to define a variable in order to use it, | 755 | You are not required to define a variable in order to use it, but |
| 756 | but the definition can supply documentation and an initial value | 756 | defining it lets you supply an initial value and documentation, which |
| 757 | in a way that tags can recognize. | 757 | can be referred to by the Emacs help facilities and other programming |
| 758 | 758 | tools. The `defvar' form also declares the variable as \"special\", | |
| 759 | INITVALUE is evaluated, and used to set SYMBOL, only if SYMBOL's value is void. | 759 | so that it is always dynamically bound even if `lexical-binding' is t. |
| 760 | If SYMBOL is buffer-local, its default value is what is set; | 760 | |
| 761 | buffer-local values are not affected. | 761 | The optional argument INITVALUE is evaluated, and used to set SYMBOL, |
| 762 | INITVALUE and DOCSTRING are optional. | 762 | only if SYMBOL's value is void. If SYMBOL is buffer-local, its |
| 763 | If DOCSTRING starts with *, this variable is identified as a user option. | 763 | default value is what is set; buffer-local values are not affected. |
| 764 | This means that M-x set-variable recognizes it. | ||
| 765 | See also `user-variable-p'. | ||
| 766 | If INITVALUE is missing, SYMBOL's value is not set. | 764 | If INITVALUE is missing, SYMBOL's value is not set. |
| 767 | 765 | ||
| 768 | If SYMBOL has a local binding, then this form affects the local | 766 | If SYMBOL has a local binding, then this form affects the local |
| @@ -771,6 +769,13 @@ load a file defining variables, with this form or with `defconst' or | |||
| 771 | `defcustom', you should always load that file _outside_ any bindings | 769 | `defcustom', you should always load that file _outside_ any bindings |
| 772 | for these variables. \(`defconst' and `defcustom' behave similarly in | 770 | for these variables. \(`defconst' and `defcustom' behave similarly in |
| 773 | this respect.) | 771 | this respect.) |
| 772 | |||
| 773 | The optional argument DOCSTRING is a documentation string for the | ||
| 774 | variable. | ||
| 775 | |||
| 776 | To define a user option, use `defcustom' instead of `defvar'. | ||
| 777 | The function `user-variable-p' also identifies a variable as a user | ||
| 778 | option if its DOCSTRING starts with *, but this behavior is obsolete. | ||
| 774 | usage: (defvar SYMBOL &optional INITVALUE DOCSTRING) */) | 779 | usage: (defvar SYMBOL &optional INITVALUE DOCSTRING) */) |
| 775 | (Lisp_Object args) | 780 | (Lisp_Object args) |
| 776 | { | 781 | { |
| @@ -845,15 +850,19 @@ usage: (defvar SYMBOL &optional INITVALUE DOCSTRING) */) | |||
| 845 | 850 | ||
| 846 | DEFUN ("defconst", Fdefconst, Sdefconst, 2, UNEVALLED, 0, | 851 | DEFUN ("defconst", Fdefconst, Sdefconst, 2, UNEVALLED, 0, |
| 847 | doc: /* Define SYMBOL as a constant variable. | 852 | doc: /* Define SYMBOL as a constant variable. |
| 848 | The intent is that neither programs nor users should ever change this value. | 853 | This declares that neither programs nor users should ever change the |
| 849 | Always sets the value of SYMBOL to the result of evalling INITVALUE. | 854 | value. This constancy is not actually enforced by Emacs Lisp, but |
| 850 | If SYMBOL is buffer-local, its default value is what is set; | 855 | SYMBOL is marked as a special variable so that it is never lexically |
| 851 | buffer-local values are not affected. | 856 | bound. |
| 852 | DOCSTRING is optional. | 857 | |
| 853 | 858 | The `defconst' form always sets the value of SYMBOL to the result of | |
| 854 | If SYMBOL has a local binding, then this form sets the local binding's | 859 | evalling INITVALUE. If SYMBOL is buffer-local, its default value is |
| 855 | value. However, you should normally not make local bindings for | 860 | what is set; buffer-local values are not affected. If SYMBOL has a |
| 856 | variables defined with this form. | 861 | local binding, then this form sets the local binding's value. |
| 862 | However, you should normally not make local bindings for variables | ||
| 863 | defined with this form. | ||
| 864 | |||
| 865 | The optional DOCSTRING specifies the variable's documentation string. | ||
| 857 | usage: (defconst SYMBOL INITVALUE [DOCSTRING]) */) | 866 | usage: (defconst SYMBOL INITVALUE [DOCSTRING]) */) |
| 858 | (Lisp_Object args) | 867 | (Lisp_Object args) |
| 859 | { | 868 | { |