GNU bug report logs - #13814
24.3.50; Dynamic variables shadowing prevent defvar

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Jorgen Schaefer <forcer@HIDDEN>; Keywords: confirmed; dated Mon, 25 Feb 2013 20:37:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.
Added tag(s) confirmed. Request was from npostavs@HIDDEN to control <at> debbugs.gnu.org. Full text available.

Message received at 13814 <at> debbugs.gnu.org:


Received: (at 13814) by debbugs.gnu.org; 26 Feb 2013 00:04:51 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Feb 25 19:04:50 2013
Received: from localhost ([127.0.0.1]:50175 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1UA82M-0007m0-JB
	for submit <at> debbugs.gnu.org; Mon, 25 Feb 2013 19:04:50 -0500
Received: from ironport2-out.teksavvy.com ([206.248.154.182]:40377)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <monnier@HIDDEN>) id 1UA82K-0007lt-Jd
	for 13814 <at> debbugs.gnu.org; Mon, 25 Feb 2013 19:04:49 -0500
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: Av8EABK/CFHO+KLv/2dsb2JhbABEuzWDWRdzgh8BBVYjEAsOJhIUGA0kiCTBLZEKA4hhnBmBXoMV
X-IPAS-Result: Av8EABK/CFHO+KLv/2dsb2JhbABEuzWDWRdzgh8BBVYjEAsOJhIUGA0kiCTBLZEKA4hhnBmBXoMV
X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; 
   d="scan'208";a="2448232"
Received: from 206-248-162-239.dsl.teksavvy.com (HELO pastel.home)
	([206.248.162.239])
	by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA;
	25 Feb 2013 19:03:04 -0500
Received: by pastel.home (Postfix, from userid 20848)
	id 8EE1F6C0A9; Mon, 25 Feb 2013 19:03:05 -0500 (EST)
From: Stefan Monnier <monnier@HIDDEN>
To: Jorgen Schaefer <forcer@HIDDEN>
Subject: Re: bug#13814: 24.3.50; Dynamic variables shadowing prevent defvar
Message-ID: <jwvmwusosdx.fsf-monnier+emacs@HIDDEN>
References: <87hal0199m.fsf@HIDDEN>
Date: Mon, 25 Feb 2013 19:03:05 -0500
In-Reply-To: <87hal0199m.fsf@HIDDEN> (Jorgen Schaefer's
	message of "Mon, 25 Feb 2013 20:30:29 +0100")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 13814
Cc: 13814 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -1.9 (-)

Thanks for filing it, so we have a clear bug-number for this long
standing problem.  If someone wants to take a crack at fixing it,
I think that we should add a `set-toplevel-default' which defvar and
defcustom could use, as for how to implement it, I you can take a look
at the check&warning in the C code of `defvar'.


        Stefan




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#13814; Package emacs. Full text available.

Message received at 13814 <at> debbugs.gnu.org:


Received: (at 13814) by debbugs.gnu.org; 25 Feb 2013 23:17:05 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Feb 25 18:17:05 2013
Received: from localhost ([127.0.0.1]:50149 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1UA7I9-0006cJ-Ju
	for submit <at> debbugs.gnu.org; Mon, 25 Feb 2013 18:17:05 -0500
Received: from fencepost.gnu.org ([208.118.235.10]:44220)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <rgm@HIDDEN>) id 1UA7I7-0006cC-JT
	for 13814 <at> debbugs.gnu.org; Mon, 25 Feb 2013 18:17:04 -0500
Received: from rgm by fencepost.gnu.org with local (Exim 4.71)
	(envelope-from <rgm@HIDDEN>)
	id 1UA7GS-0005yT-Hf; Mon, 25 Feb 2013 18:15:20 -0500
From: Glenn Morris <rgm@HIDDEN>
To: Jorgen Schaefer <forcer@HIDDEN>
Subject: Re: bug#13814: 24.3.50; Dynamic variables shadowing prevent defvar
References: <87hal0199m.fsf@HIDDEN>
X-Spook: morse MP5K-SD quiche offensive information warfare LLNL
X-Ran: NnsE:4=>Xw^kHEt;ZKa*c|vdWYm%2.|IR&e0NJItl8tqe.H:M0P]MD8whaKeStKvO,E}ph
X-Hue: red
X-Debbugs-No-Ack: yes
X-Attribution: GM
Date: Mon, 25 Feb 2013 18:15:20 -0500
In-Reply-To: <87hal0199m.fsf@HIDDEN> (Jorgen Schaefer's
	message of "Mon, 25 Feb 2013 20:30:29 +0100")
Message-ID: <xnmwusm1dj.fsf@HIDDEN>
User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Spam-Score: -4.9 (----)
X-Debbugs-Envelope-To: 13814
Cc: 13814 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -7.6 (-------)


Yes, it's a long-standing problem. Eg

http://lists.gnu.org/archive/html/emacs-devel/2004-07/msg00589.html




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#13814; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 25 Feb 2013 20:36:51 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Feb 25 15:36:51 2013
Received: from localhost ([127.0.0.1]:50031 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1UA4n4-0002mv-KM
	for submit <at> debbugs.gnu.org; Mon, 25 Feb 2013 15:36:50 -0500
Received: from eggs.gnu.org ([208.118.235.92]:44198)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <forcer@HIDDEN>) id 1UA4n1-0002mk-HU
	for submit <at> debbugs.gnu.org; Mon, 25 Feb 2013 15:36:49 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <forcer@HIDDEN>) id 1UA3l7-0006CE-Li
	for submit <at> debbugs.gnu.org; Mon, 25 Feb 2013 14:30:50 -0500
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-101.9 required=5.0 tests=BAYES_00, USER_IN_WHITELIST
	autolearn=unavailable version=3.3.2
Received: from lists.gnu.org ([208.118.235.17]:51010)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <forcer@HIDDEN>) id 1UA3l7-0006C5-CE
	for submit <at> debbugs.gnu.org; Mon, 25 Feb 2013 14:30:45 -0500
Received: from eggs.gnu.org ([208.118.235.92]:52321)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <forcer@HIDDEN>) id 1UA3l0-0005WZ-6G
	for bug-gnu-emacs@HIDDEN; Mon, 25 Feb 2013 14:30:45 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <forcer@HIDDEN>) id 1UA3kw-000691-EN
	for bug-gnu-emacs@HIDDEN; Mon, 25 Feb 2013 14:30:38 -0500
Received: from istinn.electusmatari.com ([83.169.37.145]:52071)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <forcer@HIDDEN>) id 1UA3kw-00068b-5y
	for bug-gnu-emacs@HIDDEN; Mon, 25 Feb 2013 14:30:34 -0500
Received: from orion.kollektiv-hamburg.de (hmbg-4d06b82d.pool.mediaWays.net
	[77.6.184.45])
	by istinn.electusmatari.com (Postfix) with ESMTPSA id 17421D10001E
	for <bug-gnu-emacs@HIDDEN>; Mon, 25 Feb 2013 20:30:32 +0100 (CET)
Received: by orion.kollektiv-hamburg.de (Postfix, from userid 1000)
	id 2F22632CAD6; Mon, 25 Feb 2013 20:30:30 +0100 (CET)
From: Jorgen Schaefer <forcer@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 24.3.50; Dynamic variables shadowing prevent defvar
Date: Mon, 25 Feb 2013 20:30:29 +0100
Message-ID: <87hal0199m.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 208.118.235.17
X-Spam-Score: -4.2 (----)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -6.9 (------)

When a file is autoloaded, defvar will fail to define locally-set,
dynamic variabls, resulting in such variables not being defined at all,
even after their local binding ends.

Situation:

(let ((some-var-that-influences-behavior t))
  (some-function-that-autoloads-a-library))

If the library which is autoloaded by
`some-function-that-autoloads-a-library' defines
`some-var-that-influences-behavior' using defvar or defcustom, the
variable is never bound globally because defvar thinks it's already
defined.

I would expect defvar to notice that the variable is bound only
locally/temporarily and define a global binding anyhow.

Reproduction:

Put this file, bug-lib.el, somewhere in `load-path':

-----8<----- bug-lib.el -----8<----- 

(defvar bug-variable t
  "This variable is not defined when autoloaded.")

(defun bug-variable-value ()
  bug-variable)

----->8----- ---------- ----->8-----

Then execute the following lines:

(autoload 'bug-variable-value "bug-lib.el")

(let ((bug-variable nil))
  (bug-variable-value))

=> nil

(bug-variable-value)

=> Error, `bug-variable' is not defined.


Regards,
        -- Jorgen


In GNU Emacs 24.3.50.1 (x86_64-unknown-linux-gnu)
Bzr revision: 111608 schwab@HIDDEN
Configured using:
 `configure --without-x --with-x-toolkit=no'




Acknowledgement sent to Jorgen Schaefer <forcer@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#13814; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Sun, 16 Jul 2017 02:45:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.