# HG changeset patch # User Richard M. Stallman # Date 1030159163 0 # Node ID d2259df6cb0918406553e9f19df6afc589f67a30 # Parent 3bd4234e08448058419bbe860b466e29d1348222 (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. diff -r 3bd4234e0844 -r d2259df6cb09 src/eval.c --- a/src/eval.c Sat Aug 24 03:17:18 2002 +0000 +++ b/src/eval.c Sat Aug 24 03:19:23 2002 +0000 @@ -87,7 +87,7 @@ 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 @@ 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 @@ tem = Fpurecopy (tem); Fput (sym, Qvariable_documentation, tem); } - LOADHIST_ATTACH (sym); + LOADHIST_ATTACH (Fcons (Qdefvar, sym)); } else - /* A (defvar ) should not take precedence in the load-history over - an earlier (defvar ), so only add to history if the default - value is still unbound. */ - if (NILP (tem)) - LOADHIST_ATTACH (sym); + /* Simple (defvar ) 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 @@ tem = Fpurecopy (tem); Fput (sym, Qvariable_documentation, tem); } - LOADHIST_ATTACH (sym); + LOADHIST_ATTACH (Fcons (Qdefvar, sym)); return sym; } @@ -3309,6 +3307,9 @@ Qdefun = intern ("defun"); staticpro (&Qdefun); + Qdefvar = intern ("defvar"); + staticpro (&Qdefvar); + Qand_rest = intern ("&rest"); staticpro (&Qand_rest);