[Top][All Lists]

[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 (, GNU 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

    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

(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]