unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Kevin Rodgers <ihs_4664@yahoo.com>
Subject: Re: Error: Symbol's value as variable is void
Date: Mon, 28 Mar 2005 13:18:31 -0700	[thread overview]
Message-ID: <3ar74pF6bja10U1@individual.net> (raw)
In-Reply-To: <mailman.227.1111777231.28103.help-gnu-emacs@gnu.org>

Joe Corneli wrote:
 > I wrote some code that contains the following forms:
 >
 > (defvar nero-link-regexp "\\[\\([0-9]+\\)\\]"
 >   "Regular expression that tells nero what links look like.
 > The first parenthesized subexpression is the unique string
 > denoting the webpage to load, which will sought among the
 > references.")
 >
 > (defvar nero-font-lock-keywords
 >  (eval-when-compile
 >   (list `(,nero-link-regexp . font-lock-keyword-face)))
 >   "Font lock for `nero-mode'.
 > Currently, only numbered links are fontified.")
 >
 > These work fine for me, but another person using the code reports the
 > following error upon byte-compiling:
 >
 > Compiling file /stor/garray/src/nero.el at Fri Mar 25 08:21:48 2005
 > nero.el:295:33:Error: Symbol's value as variable is void: 
nero-link-regexp
 >
 >
 > I don't see any such error when I byte compile.  I'm just curious to
 > know if using `eval-when-compile' here is bad form, or what.  I think
 > I've seen it being used in other packages in a similar context, but I
 > don't understand it well enough to know whether I should be using it
 > here.

You don't get an error because you have nero.el[c] already loaded when
you byte compile it, but the other person doesn't.  It's more reliable
to byte compile .el files in an uncustomized emacs (i.e. invoked with -q
and perhaps --no-site-file).

 > Removing it did make the other user's error go away.  I told him to
 > create a bug report, but if its just the fault of my bad code, I'd
 > like to know.  More generally, as a point of style, when is it good to
 > use `eval-when-compile'?

Only when you need it.  But since the simpler form is equivalent for
your purposes (I assume), why use the more complex eval-when-compile and
backquote form?

(defvar nero-font-lock-keywords
   (list (cons nero-link-regexp 'font-lock-keyword-face))
   "Font lock for `nero-mode'.
Currently, only numbered links are fontified.")

-- 
Kevin Rodgers

  parent reply	other threads:[~2005-03-28 20:18 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.227.1111777231.28103.help-gnu-emacs@gnu.org>
2005-03-26  0:00 ` Error: Symbol's value as variable is void Thien-Thi Nguyen
2005-03-26  2:48   ` Joe Corneli
     [not found]   ` <mailman.255.1111806378.28103.help-gnu-emacs@gnu.org>
2005-03-27  0:12     ` Stefan Monnier
2005-03-27  0:45       ` Joe Corneli
2005-03-28 20:18 ` Kevin Rodgers [this message]
2005-03-25 18:28 Joe Corneli
2005-03-25 19:26 ` Denis Bueno

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=3ar74pF6bja10U1@individual.net \
    --to=ihs_4664@yahoo.com \
    /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).