summaryrefslogtreecommitdiff
path: root/src/eval.c
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>2002-08-24 03:19:23 +0000
committerRichard M. Stallman <rms@gnu.org>2002-08-24 03:19:23 +0000
commitd7c1d0fce52d13274ba0c2654d8d8c5ac3b7e513 (patch)
tree503dc5dd018bd58f2267d9627ff201b1e323d4e3 /src/eval.c
parentd642e4f9ee5f73140413399c76f38b07d03cec6d (diff)
downloademacs-d7c1d0fce52d13274ba0c2654d8d8c5ac3b7e513.tar.gz
(Fdefvar, Fdefconst, Fdefvaralias):
Record variables in load history as (defvar . VAR). (Fdefvar): Don't record in load history if no initial value. (Qdefvar): New variable. (syms_of_eval): Init and staticpro it.
Diffstat (limited to 'src/eval.c')
-rw-r--r--src/eval.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/eval.c b/src/eval.c
index c433dae71ce..b48fbd5fa2b 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -87,7 +87,7 @@ struct catchtag *catchlist;
int gcpro_level;
#endif
-Lisp_Object Qautoload, Qmacro, Qexit, Qinteractive, Qcommandp, Qdefun;
+Lisp_Object Qautoload, Qmacro, Qexit, Qinteractive, Qcommandp, Qdefun, Qdefvar;
Lisp_Object Qinhibit_quit, Vinhibit_quit, Vquit_flag;
Lisp_Object Qand_rest, Qand_optional;
Lisp_Object Qdebug_on_error;
@@ -731,7 +731,7 @@ Third arg DOCSTRING, if non-nil, is documentation for SYMBOL. */)
sym->indirect_variable = 1;
sym->value = aliased;
sym->constant = SYMBOL_CONSTANT_P (aliased);
- LOADHIST_ATTACH (symbol);
+ LOADHIST_ATTACH (Fcons (Qdefvar, symbol));
if (!NILP (docstring))
Fput (symbol, Qvariable_documentation, docstring);
@@ -777,14 +777,12 @@ usage: (defvar SYMBOL &optional INITVALUE DOCSTRING) */)
tem = Fpurecopy (tem);
Fput (sym, Qvariable_documentation, tem);
}
- LOADHIST_ATTACH (sym);
+ LOADHIST_ATTACH (Fcons (Qdefvar, sym));
}
else
- /* A (defvar <var>) should not take precedence in the load-history over
- an earlier (defvar <var> <val>), so only add to history if the default
- value is still unbound. */
- if (NILP (tem))
- LOADHIST_ATTACH (sym);
+ /* Simple (defvar <var>) should not count as a definition at all.
+ It could get in the way of other definitions, and unloading this
+ package could try to make the variable unbound. */
return sym;
}
@@ -817,7 +815,7 @@ usage: (defconst SYMBOL INITVALUE [DOCSTRING]) */)
tem = Fpurecopy (tem);
Fput (sym, Qvariable_documentation, tem);
}
- LOADHIST_ATTACH (sym);
+ LOADHIST_ATTACH (Fcons (Qdefvar, sym));
return sym;
}
@@ -3309,6 +3307,9 @@ before making `inhibit-quit' nil. */);
Qdefun = intern ("defun");
staticpro (&Qdefun);
+ Qdefvar = intern ("defvar");
+ staticpro (&Qdefvar);
+
Qand_rest = intern ("&rest");
staticpro (&Qand_rest);