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

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

Re: font-lock-add-keywords


From: Kevin Rodgers
Subject: Re: font-lock-add-keywords
Date: Thu, 05 Aug 2004 09:39:58 -0600
User-agent: Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:0.9.4.1) Gecko/20020406 Netscape6/6.2.2

Randy Haddox wrote:
> I am using code in .emacs to find and color code various keywords.  I
> haven't had any luck handling the "if" keyword when it doesn't starting
> in column 1 (ie, has leading whitespace).  Most of the time the "if"
> will start at the beginning.
>
> (defface test-keyword6-face
>   '((t (:foreground "gold")))
>   "Keyword face.")
> (font-lock-add-keywords 'latex-mode
>   '(("^if\\|then\\|else\\|endif" . 'test-keyword6-face))
> )

Well you've explicitly anchored "if" to the beginning of the line with
"^".  (None of the other keywords are anchored, due to the low
precedence of "\\|").  Getting rid of the "^" should fix it.

--
Kevin Rodgers



reply via email to

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