>>>> "Jake" == Jake Colman
<jake.colman(a)xemacs.org> writes:
Hi Jake,
this works for me:
(add-hook 'font-lock-mode-hook
'(lambda ()
(cond ((eq major-mode 'python-mode)
(set (make-local-variable 'font-lock-keywords)
python-font-lock-keywords))
((eq major-mode 'c++-mode)
(set (make-local-variable 'font-lock-keywords)
(append c++-font-lock-keywords
'(("\\<\\(foreach\\)\\>" (1 font-lock-keyword-face t)))))))))
I guess appending to c++-font-lock-keywords requires some
reinitialization for it to update 'font-lock-keywords in c++-mode.
I haven't spend the time to find that out, but the above seems to work
just as well.
Hope this helps,
Adrian
>>>> "TC" == Tim Connors
<tconnors(a)astro.swin.edu.au> writes:
>> I tried this:
>>
>> (setq c++-font-lock-keywords
>> (append c++-font-lock-keywords
>> (list '(".*foreach.*" 1 font-lock-keyword-face t))))
>>
TC> Where you by chance getting a "fontifying blah.c...
aborted.aborted."
TC> message in the modeline?
Jake> No. I get no error messages. The new kywork simply does not fontify.
TC> Try putting brackets around the (1 font-lock-keyword-face t) list.
TC> So I have now in one of mine:
TC> (setq font-lock-keywords
TC> (append font-lock-keywords
TC> (list
TC>
'("\\<\\(d?a?\\(cos\\|sin\\|tan\\|tan\\|tan2\\)\\(deg\\)?\\|d?\\(sqrt\\|sqr\\|exp\\|abs\\|int\\|nint\\|min\\|max\\|sign\\|log\\|log10\\)\\)h?\\>"
TC> (0 font-lock-math-face append)))))
TC> )
Jake> Looking again at how existing keywords (e.g., 'for', 'while')
I tried the
Jake> following:
Jake> (setq c++-font-lock-keywords
Jake> (append c++-font-lock-keywords
Jake> (list '("\\<foreach\\>\\([^a-zA-Z0-9_$]\\|$\\)" 1
font-lock-keyword-face t))))
Jake> This still does not work.
Jake> --
Jake> Jake Colman -- XEmacs Tinkerer
--
Adrian Aichner
mailto:adrianï¼ xemacs.org
http://www.xemacs.org/