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

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

Re: Adding font-lock keywords


From: Brendan Van Horn
Subject: Re: Adding font-lock keywords
Date: 22 Apr 2003 10:10:00 -0700

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 via email to

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