[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Conditional compilation to avoid "assignment to free variable"
From: |
Michael Hoffman |
Subject: |
Conditional compilation to avoid "assignment to free variable" |
Date: |
Wed, 24 Sep 2008 12:46:26 -0700 |
User-agent: |
Thunderbird 1.5.0.12 (X11/20080411) |
I use the same .emacs file on multiple systems, and each have various
packages installed. There are various forms in my .emacs to only
interact with these packages if they are actually installed:
(when (locate-library "auctex")
(load "auctex.el" nil t t)
(setq TeX-auto-save t))
When I byte-compile, however, I get a warning like this:
emacs.el:320:9:Warning: assignment to free variable `TeX-auto-save'
Is there a way to skip over that form at compile time if the library
cannot be found? I tried various permutations of using
eval-when-compile, but I still get the warning.
I suppose the other solution is to wrap the setq in a boundp check, but
this seems silly as the result of the boundp check will be the same as
the result of locate-library.
In this case, I may be able to use a custom variable instead but I am
looking for a more general solution.
- Conditional compilation to avoid "assignment to free variable",
Michael Hoffman <=