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

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

Re: font-lock-keywords: matcher function not working


From: Raffaele Ricciardi
Subject: Re: font-lock-keywords: matcher function not working
Date: Sat, 29 Jun 2013 15:32:45 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130509 Thunderbird/17.0.6

On 29/06/13 10:53, Raffaele Ricciardi wrote:
However, unless I restart `lisp-interaction-mode', no highlighting occurs,
neither it does if I just restart `font-lock-mode'.  Why is it so?  I
was expecting
`font-lock-fontify-buffer' to apply the new rules.

Meanwhile, for those who are interested, I've discovered that
`font-lock-fontify-buffer' applies immediately any new rules applied to the
current buffer only. Therefore, while experimenting, you can use for example:

(font-lock-add-keywords nil
                        '(
("^[[:blank:]]*\\((\\)" 1 'font-lock-warning-face)
                          ))

instead of:

(font-lock-add-keywords 'lisp-interaction-mode
                        '(
("^[[:blank:]]*\\((\\)" 1 'font-lock-warning-face)
                          ))

and then call `font-lock-fontify-buffer' to see the effect. Of course, do not forget to
call `font-lock-remove-keywords' on the old rules, first.




reply via email to

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