[Top][All Lists]

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

Re: please help with font-lock-add-keywords

From: David Combs
Subject: Re: please help with font-lock-add-keywords
Date: Thu, 7 Jan 2010 00:39:06 +0000 (UTC)

In article <address@hidden>,
Tassilo Horn  <address@hidden> wrote:
>bufie <address@hidden> writes:
>> I'd like to fontify a whole bunch of function names for a project I'm
>> working on (which uses lisp mode, not emacs-lisp-mode -- for
>> reference, I'm using GNU emacs 23.1.1).
>This works for me and highlights any symbol starting with qbb- in the
>keyword face.
>--8<---------------cut here---------------start------------->8---
> 'lisp-mode
> '(("\\<qbb-[[:alnum:]-]+\\>" . font-lock-keyword-face)))
>--8<---------------cut here---------------end--------------->8---
>> (font-lock-add-keywords
>>  'lisp-mode
>>  '(("\\<\\(qbb-create-image\\|qbb-destroy-image\\)\\>" .
>>     font-lock-keyword-face)))
>Looks ok to me.
>> (font-lock-add-keywords
>>  'lisp-mode
>>  '(("\\<\\qbb-create-image\\)" 2 font-lock-keyword-face t)))
>            ^
>I think a paren is missing there.  And if there was one, you would like
>to highlight the first group, so the 2 has to be replaced with 1.
>> (add-hook 'lisp-mode-hook
>>        (lambda ()
>>          (font-lock-add-keywords
>>           nil
>>              '(("\\<\\(qbb-create-image\\|qbb-destroy-image\\)\\>" .
>>                 font-lock-keyword-face)))))
>Looks correct.  But when using the ("regexp" . face) form, you can use
>shy groups for performance reasons, because here you refer to the whole

Please, what is a "shy group"?   Some math thing?



>match anyway and not to a group by number.
>Hm, if your first and last solutions don't work, I'd guess you are not
>in lisp-mode...

reply via email to

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