]> git.eshelyaron.com Git - emacs.git/commitdiff
(Fdefvar): Only record (defvar <var>) in the load-history
authorStefan Monnier <monnier@iro.umontreal.ca>
Mon, 14 May 2001 20:53:03 +0000 (20:53 +0000)
committerStefan Monnier <monnier@iro.umontreal.ca>
Mon, 14 May 2001 20:53:03 +0000 (20:53 +0000)
in <var> has no default value yet.

src/ChangeLog
src/eval.c

index 9cd3520dcb63aea1a55cbe5d201ec866f0dcdc9a..d49a0e6c0fca5a76dd6c22ca7b468568269a999f 100644 (file)
@@ -1,5 +1,8 @@
 2001-05-14  Stefan Monnier  <monnier@cs.yale.edu>
 
+       * eval.c (Fdefvar): Only record (defvar <var>) in the load-history
+       in <var> has no default value yet.
+
        * xfaces.c (try_alternative_families): First try the FAMILY.
        And if nothing is found in the end, try again with scalable fonts.
        (try_font_list): Let try_alternative_families do a bit more of
@@ -10,7 +13,7 @@
 
        * xterm.c (note_mouse_highlight): Avoid changing the mouse
        pointer shape when show_mouse_face has already done it.
-       
+
        * xterm.c (x_draw_glyphs): Fix computation of rightmost x for
        full-width rows.
 
index f7dd17eb5eae9cfcd40377c5c87f43e346587ff7..42dcc814bb6732ead5d6136429b4e603274f7e51 100644 (file)
@@ -686,21 +686,28 @@ If INITVALUE is missing, SYMBOL's value is not set.")
   if (!NILP (Fcdr (Fcdr (tail))))
     error ("too many arguments");
 
+  tem = Fdefault_boundp (sym);
   if (!NILP (tail))
     {
-      tem = Fdefault_boundp (sym);
       if (NILP (tem))
-       Fset_default (sym, Feval (Fcar (Fcdr (args))));
-    }
-  tail = Fcdr (Fcdr (args));
-  if (!NILP (Fcar (tail)))
-    {
-      tem = Fcar (tail);
-      if (!NILP (Vpurify_flag))
-       tem = Fpurecopy (tem);
-      Fput (sym, Qvariable_documentation, tem);
+       Fset_default (sym, Feval (Fcar (tail)));
+      tail = Fcdr (tail);
+      if (!NILP (Fcar (tail)))
+       {
+         tem = Fcar (tail);
+         if (!NILP (Vpurify_flag))
+           tem = Fpurecopy (tem);
+         Fput (sym, Qvariable_documentation, tem);
+       }
+      LOADHIST_ATTACH (sym);
     }
-  LOADHIST_ATTACH (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);
+    
   return sym;
 }