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

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

Re: Conditional compilation to avoid "assignment to free variable"


From: Joost Diepenmaat
Subject: Re: Conditional compilation to avoid "assignment to free variable"
Date: Wed, 24 Sep 2008 21:54:03 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

Michael Hoffman <4g4trz802@sneakemail.com> writes:

> 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.

Did you try the following?

(eval-when-compile
  (require 'my-macro-package))

(when (locate-library "auctex")
  (setq TeX-auto-save t))

HTH,
Joost.

-- 
Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/


reply via email to

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