[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.
- font-lock-add-keywords frustrations, Jesse Sheidlower, 2003/05/17
- Re: font-lock-add-keywords frustrations, Stefan Monnier, 2003/05/18
- Re: font-lock-add-keywords frustrations,
Glenn Morris <=
- Re: font-lock-add-keywords frustrations, Jesse Sheidlower, 2003/05/18
- Re: font-lock-add-keywords frustrations, Stefan Monnier, 2003/05/18
- Re: font-lock-add-keywords frustrations, Martin Stemplinger, 2003/05/22
- Re: font-lock-add-keywords frustrations, Stefan Monnier, 2003/05/22
- Re: font-lock-add-keywords frustrations, John L Fjellstad, 2003/05/30
- Re: font-lock-add-keywords frustrations, Stefan Monnier, 2003/05/30