aboutsummaryrefslogtreecommitdiffstats
path: root/src/eval.c
diff options
context:
space:
mode:
authorChong Yidong2012-02-15 12:00:34 +0800
committerChong Yidong2012-02-15 12:00:34 +0800
commitc3a70e2b95e4cf41b1a671f7d721f0ba4aaff679 (patch)
treee1632789ac2c8118ccac24691c4a91fe57109c55 /src/eval.c
parent9f26dc243268eddc252287ef1918970bf580e946 (diff)
downloademacs-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.
Diffstat (limited to 'src/eval.c')
-rw-r--r--src/eval.c49
1 files changed, 29 insertions, 20 deletions
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
781DEFUN ("defvar", Fdefvar, Sdefvar, 1, UNEVALLED, 0, 781DEFUN ("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.
783You are not required to define a variable in order to use it, 783You are not required to define a variable in order to use it, but
784but the definition can supply documentation and an initial value 784defining it lets you supply an initial value and documentation, which
785in a way that tags can recognize. 785can be referred to by the Emacs help facilities and other programming
786 786tools. The `defvar' form also declares the variable as \"special\",
787INITVALUE is evaluated, and used to set SYMBOL, only if SYMBOL's value is void. 787so that it is always dynamically bound even if `lexical-binding' is t.
788If SYMBOL is buffer-local, its default value is what is set; 788
789 buffer-local values are not affected. 789The optional argument INITVALUE is evaluated, and used to set SYMBOL,
790INITVALUE and DOCSTRING are optional. 790only if SYMBOL's value is void. If SYMBOL is buffer-local, its
791If DOCSTRING starts with *, this variable is identified as a user option. 791default 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'.
794If INITVALUE is missing, SYMBOL's value is not set. 792If INITVALUE is missing, SYMBOL's value is not set.
795 793
796If SYMBOL has a local binding, then this form affects the local 794If 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
800for these variables. \(`defconst' and `defcustom' behave similarly in 798for these variables. \(`defconst' and `defcustom' behave similarly in
801this respect.) 799this respect.)
800
801The optional argument DOCSTRING is a documentation string for the
802variable.
803
804To define a user option, use `defcustom' instead of `defvar'.
805The function `user-variable-p' also identifies a variable as a user
806option if its DOCSTRING starts with *, but this behavior is obsolete.
802usage: (defvar SYMBOL &optional INITVALUE DOCSTRING) */) 807usage: (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
874DEFUN ("defconst", Fdefconst, Sdefconst, 2, UNEVALLED, 0, 879DEFUN ("defconst", Fdefconst, Sdefconst, 2, UNEVALLED, 0,
875 doc: /* Define SYMBOL as a constant variable. 880 doc: /* Define SYMBOL as a constant variable.
876The intent is that neither programs nor users should ever change this value. 881This declares that neither programs nor users should ever change the
877Always sets the value of SYMBOL to the result of evalling INITVALUE. 882value. This constancy is not actually enforced by Emacs Lisp, but
878If SYMBOL is buffer-local, its default value is what is set; 883SYMBOL is marked as a special variable so that it is never lexically
879 buffer-local values are not affected. 884bound.
880DOCSTRING is optional. 885
881 886The `defconst' form always sets the value of SYMBOL to the result of
882If SYMBOL has a local binding, then this form sets the local binding's 887evalling INITVALUE. If SYMBOL is buffer-local, its default value is
883value. However, you should normally not make local bindings for 888what is set; buffer-local values are not affected. If SYMBOL has a
884variables defined with this form. 889local binding, then this form sets the local binding's value.
890However, you should normally not make local bindings for variables
891defined with this form.
892
893The optional DOCSTRING specifies the variable's documentation string.
885usage: (defconst SYMBOL INITVALUE [DOCSTRING]) */) 894usage: (defconst SYMBOL INITVALUE [DOCSTRING]) */)
886 (Lisp_Object args) 895 (Lisp_Object args)
887{ 896{