comparison src/eval.c @ 37732:f98176963881

(Fdefvar): Only record (defvar <var>) in the load-history in <var> has no default value yet.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Mon, 14 May 2001 20:52:07 +0000
parents 451c5848dd13
children d10de887e52e
comparison
equal deleted inserted replaced
37731:7c313c4b3eba 37732:f98176963881
684 sym = Fcar (args); 684 sym = Fcar (args);
685 tail = Fcdr (args); 685 tail = Fcdr (args);
686 if (!NILP (Fcdr (Fcdr (tail)))) 686 if (!NILP (Fcdr (Fcdr (tail))))
687 error ("too many arguments"); 687 error ("too many arguments");
688 688
689 tem = Fdefault_boundp (sym);
689 if (!NILP (tail)) 690 if (!NILP (tail))
690 { 691 {
691 tem = Fdefault_boundp (sym);
692 if (NILP (tem)) 692 if (NILP (tem))
693 Fset_default (sym, Feval (Fcar (Fcdr (args)))); 693 Fset_default (sym, Feval (Fcar (tail)));
694 } 694 tail = Fcdr (tail);
695 tail = Fcdr (Fcdr (args)); 695 if (!NILP (Fcar (tail)))
696 if (!NILP (Fcar (tail))) 696 {
697 { 697 tem = Fcar (tail);
698 tem = Fcar (tail); 698 if (!NILP (Vpurify_flag))
699 if (!NILP (Vpurify_flag)) 699 tem = Fpurecopy (tem);
700 tem = Fpurecopy (tem); 700 Fput (sym, Qvariable_documentation, tem);
701 Fput (sym, Qvariable_documentation, tem); 701 }
702 } 702 LOADHIST_ATTACH (sym);
703 LOADHIST_ATTACH (sym); 703 }
704 else
705 /* A (defvar <var>) should not take precedence in the load-history over
706 an earlier (defvar <var> <val>), so only add to history if the default
707 value is still unbound. */
708 if (NILP (tem))
709 LOADHIST_ATTACH (sym);
710
704 return sym; 711 return sym;
705 } 712 }
706 713
707 DEFUN ("defconst", Fdefconst, Sdefconst, 2, UNEVALLED, 0, 714 DEFUN ("defconst", Fdefconst, Sdefconst, 2, UNEVALLED, 0,
708 "Define SYMBOL as a constant variable.\n\ 715 "Define SYMBOL as a constant variable.\n\