From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.devel Subject: Trouble with eval-when-compile. Date: Wed, 31 Aug 2011 13:55:30 +0000 Message-ID: <20110831135530.GA4169@acm.acm> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1314799152 2833 80.91.229.12 (31 Aug 2011 13:59:12 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 31 Aug 2011 13:59:12 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Aug 31 15:59:09 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QylJr-00086l-KP for ged-emacs-devel@m.gmane.org; Wed, 31 Aug 2011 15:59:08 +0200 Original-Received: from localhost ([::1]:43075 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QylJr-0003eM-0h for ged-emacs-devel@m.gmane.org; Wed, 31 Aug 2011 09:59:07 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:51803) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QylJp-0003dm-10 for emacs-devel@gnu.org; Wed, 31 Aug 2011 09:59:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QylJn-0006xU-Ag for emacs-devel@gnu.org; Wed, 31 Aug 2011 09:59:04 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:25946 helo=mail.muc.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QylJn-0006xE-13 for emacs-devel@gnu.org; Wed, 31 Aug 2011 09:59:03 -0400 Original-Received: (qmail 35227 invoked by uid 3782); 31 Aug 2011 13:59:00 -0000 Original-Received: from acm.muc.de (pD951A52A.dip.t-dialin.net [217.81.165.42]) by ocolin.muc.de (tmda-ofmipd) with ESMTP; Wed, 31 Aug 2011 15:58:59 +0200 Original-Received: (qmail 4259 invoked by uid 1000); 31 Aug 2011 13:55:30 -0000 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 193.149.48.1 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:143661 Archived-At: 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).