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

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

A problem in using font-lock-add-keywords


From: source liu
Subject: A problem in using font-lock-add-keywords
Date: Tue, 5 Mar 2013 10:54:20 +0800

Hi, list


1. about font-lock-add-keywords
I'm new to elisp, and i want to add some keywords to a mode( say,
c-mode), a list is below,
(defvar my-list '("FIXME" "AND" "OR"))


and I find some hint in emacs help  C-h f "font-lock-add-keywords"

========= reference from the buff of help ===========
 (add-hook 'c-mode-hook
  (lambda ()
   (font-lock-add-keywords nil
    '(("\\<\\(FIXME\\):" 1 font-lock-warning-face prepend)
      ("\\<\\(and\\|or\\|not\\)\\>" .
       font-lock-keyword-face)))))
==========================================

i've tested it, it works, but when i change the expression of
"\\<(FIXME\\):"  by (regexp-opt mylist t), it can't work.  does
someone give me some hint where my problem is?

2. by the way, does emacs list have a max length?
i find when the list is beyond about 4600 words, the bracket ")" cant match "("






-- 
Liu An
Institution of modern physics, Shanghai, China



reply via email to

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