Function: defconst
defconst is a special form defined in eval.c.
Signature
(defconst SYMBOL INITVALUE [DOCSTRING])
Documentation
Define SYMBOL as a constant variable.
This declares that neither programs nor users should ever change the value. This constancy is not actually enforced by Emacs Lisp, but SYMBOL is marked as a special variable so that it is never lexically bound.
The defconst form always sets the value of SYMBOL to the result of
evalling INITVALUE. If SYMBOL is buffer-local, its default value is
what is set; buffer-local values are not affected. If SYMBOL has a
local binding, then this form sets the local binding's value.
However, you should normally not make local bindings for variables
defined with this form.
The optional DOCSTRING specifies the variable's documentation string.
Probably introduced at or before Emacs version 1.5.
Source Code
// Defined in /usr/src/emacs/src/eval.c
{
Lisp_Object sym, tem;
sym = XCAR (args);
CHECK_SYMBOL (sym);
Lisp_Object docstring = Qnil;
if (!NILP (XCDR (XCDR (args))))
{
if (!NILP (XCDR (XCDR (XCDR (args)))))
error ("Too many arguments");
docstring = XCAR (XCDR (XCDR (args)));
}
tem = eval_sub (XCAR (XCDR (args)));
return Fdefconst_1 (sym, tem, docstring);
}