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

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

Re: `font-lock-add-keywords' adds wrong face.


From: Andreas Politz
Subject: Re: `font-lock-add-keywords' adds wrong face.
Date: Wed, 08 Dec 2010 15:18:00 -0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

Elena <egarrulo@gmail.com> writes:

> Hello,
>
> I'm trying to highlight global variables (surrounded by "*") in `emacs-
> lisp-mode'. Highlighting works, but with a wrong face. Here is my code
> (evaluated in a fresh "emacs -Q"):
>
> (font-lock-add-keywords 'emacs-lisp-mode
>   '("\\_<\\*\\(?:\\w\\|\\s_\\)+\\*\\_>" . 'font-lock-warning-face)
>   t)
>
> However, global variables are highlighted with `font-lock-keyword-
> face' (comments are highlighted correctly).
>
> What am I missing? Thanks.

You missed reading the documentation of `font-lock-add-keywords', which
lead me to the following version.

(font-lock-add-keywords 'emacs-lisp-mode
  '(("\\_<\\*\\(?:\\w\\|\\s_\\)+\\*\\_>" . 'font-lock-warning-face)))

-ap


reply via email to

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