[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: defvar inside let-binding

From: Lars Magne Ingebrigtsen
Subject: Re: defvar inside let-binding
Date: Tue, 02 Aug 2011 15:42:42 +0200
User-agent: Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.50 (gnu/linux)

Stefan Monnier <address@hidden> writes:

> Yes, just like with defvar.  The difference is that defvar detects the
> problem and outputs a warning.

Ah, ok.  So if we decide to change the way let-bindings affect defvar
when we load files, then we have to basically implement the same
detection for defcustom.

Which we probably should do anyway.  :-)

It's this code, right?

      if (NILP (tem))
        Fset_default (sym, eval_sub (Fcar (tail)));
        { /* Check if there is really a global binding rather than just a let
             binding that shadows the global unboundness of the var.  */
          volatile 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 
                                       SYMBOL_NAME (sym), 1);

Since `defcustom' seems to be purely Emacs Lisp, and I don't think this
data is available on the Emacs Lisp level (am I wrong?), perhaps just
creating a C-level function `symbol-let-bound-p' (or something) would
allow us to issue the warning, as a first step?
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog http://lars.ingebrigtsen.no/

reply via email to

[Prev in Thread] Current Thread [Next in Thread]