[Top][All Lists]

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

custom colorizing keywords

From: ken
Subject: custom colorizing keywords
Date: Sun, 12 Mar 2006 08:29:35 -0500
User-agent: Mozilla Thunderbird 1.0 (X11/20041207)

Wishing to colorize some of my own keywords, I stumbled across
font-lock-add-keywords and did C-h f on it.  I'm not an elisp
programmer, so of course the explanations there made hardly any sense.
So I tried just altering the example:

 (font-lock-add-keywords 'c-mode
  '(("\\<\\(FIXME\\):" 1 font-lock-warning-face prepend)
    ("\\<\\(and\\|or\\|not\\)\\>" . font-lock-keyword-face)))

The help page says "MODE should be a symbol, the major mode command
name, such as `c-mode' or nil."  Because I want to highlight the added
keywords in all modes, I did this:

(font-lock-add-keywords nil
  '(("\\<\\(FIXME\\):" 1 font-lock-warning-face prepend)
    ("\\<\\(XXX\\|xxx\\|???\\)\\>" . font-lock-keyword-face)))

Evaluating this failed, told me "Fontifying region...(invalid-regexp
Invalid regular expression)".  I've read enough elisp code that I pretty
much knew that there shouldn't be an apostrophe (') in front of nil, but
I tried it anyway.  Got the same error message.

I tried a lot of other things, but this is the easiest yet most
perplexing of several questions.  Searching the archives and EmacsWiki
yeilded nothing helpful.  Is what I'm asking even possible to do?

Thanks for any assistance.

"This world ain't big enough for the both of us,"
said the big noema to the little noema.

reply via email to

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