GNU bug report logs -
#13814
24.3.50; Dynamic variables shadowing prevent defvar
Previous Next
Reported by: Jorgen Schaefer <forcer <at> forcix.cx>
Date: Mon, 25 Feb 2013 20:37:01 UTC
Severity: normal
Tags: confirmed, moreinfo
Found in version 24.3.50
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
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 <at> linux-m68k.org-20130126151309-wk3nb8t4xitw94lh
Configured using:
`configure --without-x --with-x-toolkit=no'
This bug report was last modified 3 years and 273 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.