Mercurial > emacs
diff src/eval.c @ 58413:73c39b73a189
(Fdefvar): Warn when var is let-bound but globally void.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Mon, 22 Nov 2004 05:26:50 +0000 |
parents | 975ba3cd4a50 |
children | 4f9314a314aa |
line wrap: on
line diff
--- a/src/eval.c Mon Nov 22 05:07:07 2004 +0000 +++ b/src/eval.c Mon Nov 22 05:26:50 2004 +0000 @@ -786,6 +786,21 @@ { if (NILP (tem)) Fset_default (sym, Feval (Fcar (tail))); + else + { /* Check if there is really a global binding rather than just a let + binding that shadows the global unboundness of the var. */ + struct specbinding *pdl = specpdl_ptr; + while (--pdl >= specpdl) + { + if (EQ (pdl->symbol, sym) && !pdl->func + && EQ (pdl->old_value, Qunbound)) + { + message_with_string ("Warning: defvar ignored because %s is let-bound", + SYMBOL_NAME (sym), 1); + break; + } + } + } tail = Fcdr (tail); tem = Fcar (tail); if (!NILP (tem))