all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Lars Magne Ingebrigtsen <larsi@gnus.org>
To: emacs-devel@gnu.org
Subject: Re: defvar inside let-binding
Date: Tue, 02 Aug 2011 15:42:42 +0200	[thread overview]
Message-ID: <m3mxfsexpp.fsf@stories.gnus.org> (raw)
In-Reply-To: jwvmxfsrfr5.fsf-monnier+emacs@gnu.org

Stefan Monnier <monnier@iro.umontreal.ca> 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)));
      else
	{ /* 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;
		}
	    }
	}

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	other threads:[~2011-08-02 13:42 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-15 14:38 bug#9090: 24.0.50; void-variable jka-compr-verbose lee
2011-07-15 17:04 ` Glenn Morris
2011-07-15 18:11   ` Lars Magne Ingebrigtsen
2011-07-15 18:20     ` Glenn Morris
2011-07-18 14:03     ` defvar inside let-binding (was: bug#9090: 24.0.50; void-variable jka-compr-verbose) Stefan Monnier
2011-07-18 14:20       ` defvar inside let-binding Lars Magne Ingebrigtsen
2011-07-18 16:18         ` Stefan Monnier
2011-07-19 16:14           ` Lars Magne Ingebrigtsen
2011-08-01 21:20             ` Stefan Monnier
2011-08-02 13:42               ` Lars Magne Ingebrigtsen [this message]
2011-08-02 19:22                 ` Stefan Monnier
2011-08-02 19:56                   ` Lars Magne Ingebrigtsen
2011-08-02 20:47                     ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3mxfsexpp.fsf@stories.gnus.org \
    --to=larsi@gnus.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.