unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Re: `font-lock-add-keywords' adds wrong face.
       [not found] <69bbb835-a58e-411b-acd9-d4ce67af23b2@i31g2000yqm.googlegroups.com>
@ 2010-07-08 12:51 ` Elena
  2010-07-08 14:34 ` Andreas Politz
  1 sibling, 0 replies; 2+ messages in thread
From: Elena @ 2010-07-08 12:51 UTC (permalink / raw)
  To: help-gnu-emacs

Forgot to mention:

Emacs version: GNU Emacs 23.1.1 (i386-mingw-nt5.1.2600) of 2009-07-30
on SOFT-MJASON

Windows XP SP3


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: `font-lock-add-keywords' adds wrong face.
       [not found] <69bbb835-a58e-411b-acd9-d4ce67af23b2@i31g2000yqm.googlegroups.com>
  2010-07-08 12:51 ` `font-lock-add-keywords' adds wrong face Elena
@ 2010-07-08 14:34 ` Andreas Politz
  1 sibling, 0 replies; 2+ messages in thread
From: Andreas Politz @ 2010-07-08 14:34 UTC (permalink / raw)
  To: help-gnu-emacs

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-07-08 14:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <69bbb835-a58e-411b-acd9-d4ce67af23b2@i31g2000yqm.googlegroups.com>
2010-07-08 12:51 ` `font-lock-add-keywords' adds wrong face Elena
2010-07-08 14:34 ` Andreas Politz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).