[Top][All Lists]

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

Trouble with eval-when-compile.

From: Alan Mackenzie
Subject: Trouble with eval-when-compile.
Date: Wed, 31 Aug 2011 13:55:30 +0000
User-agent: Mutt/1.5.21 (2010-09-15)

Hi, everybody.

Any chance of a tip?

I have two files like this (grossly simplified, of course):

    (defconst str "Foo")
    (provide 'when-compile-sub)

      (require 'when-compile-sub))

    (defconst strng `,str)
    (message "strng is %s" strng)

I think it's clear what I want to do - that is, to (require
when-compile-sub.elc) only at compile time, and use the value of a
constant at runtime in the main file.

Both files compile OK.  But when I try to load when-compile.elc, with

    emacs -Q -batch -l when-compile.elc

, I get the error message:

    Symbol's value as variable is void: str

What is going on here?  str is merely a compile time constant.  Why is
anything about str still hanging around at runtime?

Alan Mackenzie (Nuremberg, Germany).

reply via email to

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