unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Chetan <Chetan.xspam@xspam.sbcglobal.net>
To: help-gnu-emacs@gnu.org
Subject: Re: Conditional compilation to avoid "assignment to free variable"
Date: Wed, 24 Sep 2008 14:34:35 -0700	[thread overview]
Message-ID: <u1vz99qj8.fsf@myhost.sbcglobal.net> (raw)
In-Reply-To: gbe5ej$67r$1@aioe.org

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.
>
> 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.
C-h f eval-when-compile


  parent reply	other threads:[~2008-09-24 21:34 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-24 19:46 Conditional compilation to avoid "assignment to free variable" Michael Hoffman
2008-09-24 19:54 ` Joost Diepenmaat
2008-09-24 21:34 ` Chetan [this message]
2008-09-24 22:09 ` Glenn Morris
2008-09-25  0:11 ` Chetan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=u1vz99qj8.fsf@myhost.sbcglobal.net \
    --to=chetan.xspam@xspam.sbcglobal.net \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).