[Top][All Lists]

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

Re: Evaluating a 'variable' in a nested list

From: Dmitry Dzhus
Subject: Re: Evaluating a 'variable' in a nested list
Date: Wed, 21 Apr 2010 23:16:55 +0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

Tim Johnson wrote:

> When I load a scheme file, syntax highlight fails and I get the 
> following error message:
> """
> Error during redisplay: (void-function scheme-user-keywords-regexp)
> """
> I believe that I have coded the following form:
> '((scheme-user-keywords-regexp 1 scheme-font-lock-user-keywords-face t))
> Incorrectly, so that 'scheme-user-keywords-regexp is being treated 
> as a function when the hook is run.

By reading docs for `font-lock-add-keywords` function and
`font-lock-keywords`, you may find out that each element of keywords
list starts from either regexp or name of function to be called to match
string for highlighting. Since you've used the quote syntax,
`scheme-user-keywords` is added into the list of font lock rules as a
symbol and is then treated as a function name. You may use the
quasiquote syntax to evaluate just one element of list you use for

    (add-hook 'scheme-mode-hook
              (lambda ()
                 `((,scheme-user-keywords-regexp 0 
scheme-font-lock-user-keywords-face t)))))

So *the value* of `scheme-user-keywords-regexp` gets into the list.

Note that since your matcher regular expression has no subexpressions,
you must use index 0 to highlight the whole matched string; instead, you
could've just used this:

    (add-hook 'scheme-mode-hook
              (lambda ()
                 `((,scheme-user-keywords-regexp . 
Happy Hacking.

reply via email to

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