help-gnu-emacs
[Top][All Lists]
Advanced

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

Splitting emacs source files without getting 'reference to free variable


From: Joe Riel
Subject: Splitting emacs source files without getting 'reference to free variable' errors
Date: Sat, 23 Mar 2013 08:57:12 -0700

Is there a sane way to split the source of an elisp file
while avoiding the 'reference to free variable' warnings
when byte-compiling?

The problem arises when a variable defined in one file
is used in another.   How does one avoid those errors?
I have half a dozen source files that are all required
by one package.  A variable may be used in several files
(generally it is used mainly in one file, which is where
it is defined (with defvar), but, must be used in another.
I've tried adding 

(eval-when-compile
  (require 'other-source-file))

to avoid the error; that sort of works, but not
when two files each uses a variable defined in the other.

There has to be a better way.


-- 
Joe Riel




reply via email to

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