unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Andreas Politz <politza@fh-trier.de>
To: help-gnu-emacs@gnu.org
Subject: Re: `font-lock-add-keywords' adds wrong face.
Date: Thu, 08 Jul 2010 16:34:38 +0200	[thread overview]
Message-ID: <87k4p6ghz5.fsf@fh-trier.de> (raw)
In-Reply-To: 69bbb835-a58e-411b-acd9-d4ce67af23b2@i31g2000yqm.googlegroups.com

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


      parent reply	other threads:[~2010-07-08 14:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87k4p6ghz5.fsf@fh-trier.de \
    --to=politza@fh-trier.de \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).