emacs-devel
[Top][All Lists]
Advanced

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

Re: How can url-show-status be void when (featurep 'url-vars) is t?


From: Kevin Rodgers
Subject: Re: How can url-show-status be void when (featurep 'url-vars) is t?
Date: Mon, 28 Jun 2010 23:45:59 -0600
User-agent: Thunderbird 2.0.0.24 (Macintosh/20100228)

Lennart Borgman wrote:
On Sun, Jun 27, 2010 at 8:08 PM, Andreas Schwab <address@hidden> wrote:
Lennart Borgman <address@hidden> writes:

Any ideas how then url-show-status can be void after loading url-vars?
ELISP> (let (url-show-status) (load "url-vars"))
t
ELISP> (boundp 'url-show-status)
nil

Ah, thanks. I managed to move (require 'url-vars) inside the let-clause.

That is pretty easy to do when you are restructuring something. I did
not notice until many months later so I had forgotten about the change
of course.

`C-h f defvar'

If SYMBOL has a local binding, then this form affects the local
binding.  This is usually not what you want.  Thus, if you need to
load a file defining variables, with this form or with `defconst' or
`defcustom', you should always load that file _outside_ any bindings
for these variables.  (`defconst' and `defcustom' behave similarly in
this respect.)

Wouldn't it be possible for defvar, defcustom etc to detect that situation?

defvar does this:

        { /* 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 
let-bound",
                                       SYMBOL_NAME (sym), 1);
                  break;
                }
            }
        }

--
Kevin Rodgers
Denver, Colorado, USA




reply via email to

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