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

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

Re: keywords highlighting


From: Kirill Kuvaldin
Subject: Re: keywords highlighting
Date: 8 Feb 2006 08:08:55 +0100
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux)

Tim Johnson <tim@johnsons-web.com> writes:

>    Kirill, I recommend that you do an appropos search on 
>    "font" "font-lock", etc. As in C-h, a, "font-lock".
>
>    More advanced users can tell you what file extensions
>    that emacs "knows about automatically", in my case:
>    here is an example from my .emacs file:

Everythink ok with fontlocking, by keywords highlighting I didn't mean the 
syntax highlighting. It's that emacs does by default.
I meant that keywords (FIXME, TODO) should be highlighted wherever they occur,
I'd like to use them in my code in comments representing the places in code 
that need to be modified in future.

Just found such solution:

(setq keyword-highlight-modes 
      '(php-mode java-mode c-mode c++-mode emacs-lisp-mode scheme-mode))

(make-face 'font-lock-fixme-face)
(make-face 'font-lock-todo-face)

(mapc (lambda (mode)
        (font-lock-add-keywords
         mode
         '(("\\<\\(FIXME\\)" 1 'font-lock-fixme-face t))))
      keyword-highlight-modes)

(mapc (lambda (mode)
        (font-lock-add-keywords
         mode
         '(("\\<\\(TODO\\)" 1 'font-lock-todo-face t))))
      keyword-highlight-modes)

(modify-face 'font-lock-fixme-face "black" "yellow" nil t nil t nil nil) 
(modify-face 'font-lock-todo-face  "black" "yellow" nil t nil nil nil nil)

-- 
kuvkir


reply via email to

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