unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: brendan_vanhorn@yahoo.com (Brendan Van Horn)
Subject: Re: Adding font-lock keywords
Date: 22 Apr 2003 10:10:00 -0700	[thread overview]
Message-ID: <82f061b2.0304220910.5a3033cb@posting.google.com> (raw)
In-Reply-To: ex65p6u9sj.fsf@xpc21.ast.cam.ac.uk

Glenn Morris <gmorris+news@ast.cam.ac.uk> wrote...

> What you are doing is adding the symbol my-win32-constant-keywords
> to the keywords list, rather than its value.

Ahh...

> (font-lock-add-keywords
>  'c++-mode
>  `((,my-win32-constant-keywords . font-lock-constant-face)))

Just the ticket.  Here's is what I have that is (mostly) working:

(setq my-win32-constant-keywords
      (regexp-opt
       '("COINIT_MULTITHREADED" "ICC_COOL_CLASSES" "NULL"
	 "SW_SHOWDEFAULT" "VT_BSTR" "VT_ERROR" "VT_I4"
	 "vtEmpty" "vtError" "vtMissing")))

(defun my-add-keywords ()
  (font-lock-add-keywords 'c++-mode
   `(("@\\(?:TODO\\|todo\\)" . font-lock-warning-face)
     (,my-win32-constant-keywords . font-lock-constant-face))))
(add-hook 'c++-mode-hook 'my-add-keywords)
 
> because ` acts like ' except that anything preceded by a comma gets
> evaluated.

I see that now.  Thanks for the help!

      reply	other threads:[~2003-04-22 17:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-04-21 21:05 Adding font-lock keywords Brendan Van Horn
2003-04-22 10:05 ` Glenn Morris
2003-04-22 17:10   ` Brendan Van Horn [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=82f061b2.0304220910.5a3033cb@posting.google.com \
    --to=brendan_vanhorn@yahoo.com \
    /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).