From: Alan Mackenzie <acm@muc.de>
To: emacs-devel@gnu.org
Subject: Trouble with eval-when-compile.
Date: Wed, 31 Aug 2011 13:55:30 +0000 [thread overview]
Message-ID: <20110831135530.GA4169@acm.acm> (raw)
Hi, everybody.
Any chance of a tip?
I have two files like this (grossly simplified, of course):
when-compile-sub.el:
(defconst str "Foo")
(provide 'when-compile-sub)
when-compile.el:
(eval-when-compile
(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).
next reply other threads:[~2011-08-31 13:55 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-31 13:55 Alan Mackenzie [this message]
2011-08-31 14:22 ` Trouble with eval-when-compile Helmut Eller
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110831135530.GA4169@acm.acm \
--to=acm@muc.de \
--cc=emacs-devel@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.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.