emacs-pretest-bug
[Top][All Lists]
Advanced

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

Re: Symbol's value as variable when byte-compiling an eval-when-compile


From: Stefan Monnier
Subject: Re: Symbol's value as variable when byte-compiling an eval-when-compile
Date: Sat, 26 Mar 2005 10:17:28 -0500
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (darwin)

> (defvar nero-link-regexp "\\[\\([0-9]+\\)\\]"
> (defvar nero-font-lock-keywords
>  (eval-when-compile
>   (list `(,nero-link-regexp . font-lock-keyword-face)))

When byte-compiling, nero-link-regexp will be compiled (i.e. some code will
be output for it) but not evaluated (the variable is not defined).
Then when the byte-compiler gets to nero-font-lock-keywords,
eval-when-compile tells it to evaluate (list `(,nero-link-regexp .
font-lock-keyword-face)) where nero-link-regexp will signal an error.

>    a. Why the package author wasn't seeing the original file byte-compile
>    error with a recent  CVS snapshot on MacOS, yet I was on gnu/linux?

He was most likely byte-compiling in an Emacs where nero.el was already
loaded, so nero-link-regexp was already defined (tho maybe to a different
value, so he may have generated a wrong .elc file that hard-coded the old
value).

BTW, tell him that mixing list & backquote like he did is ugly, he'd
better use:

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



        Stefan




reply via email to

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