help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: font-lock-add-keywords frustrations


From: Glenn Morris
Subject: Re: font-lock-add-keywords frustrations
Date: Sun, 18 May 2003 11:14:53 +0100
User-agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/)

Jesse Sheidlower wrote:

> (defface test-face
[...]
> (font-lock-add-keywords 'psgml-mode
>   '(("slam" . test-face)))

Try quoting test-face:

(font-lock-add-keywords 'psgml-mode
  '(("slam" . 'test-face)))

Though I do not have psgml-mode, that works for me in lisp-mode, etc.
In the documentation of the variable `font-lock-keywords', you will
find

    FACENAME is an expression whose *value* is the face name to use.

(my emphasis). Thus, in your version, the font-lock machinery was
trying to evaluate test-face as a variable. The examples given in the
documentation for the function `font-lock-add-keywords' make use of
the fact that `font-lock-variable-name-face' etc are also variables
whose values are faces of the same name. Perhaps this is unfortunate
in the context of an example. So, another way round your problem would
be

(setq test-face 'test-face)

ie make test-face's variable definition be the face test-face.


reply via email to

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