From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Raffaele Ricciardi Newsgroups: gmane.emacs.help Subject: Re: font-lock-keywords: matcher function not working Date: Sat, 29 Jun 2013 15:32:45 +0200 Message-ID: References: <8d3f8211-d708-4e79-aab4-6cc8141c6c92@googlegroups.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1372514589 26314 80.91.229.3 (29 Jun 2013 14:03:09 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 29 Jun 2013 14:03:09 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Jun 29 16:03:09 2013 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Usvk4-0005kY-Su for geh-help-gnu-emacs@m.gmane.org; Sat, 29 Jun 2013 16:03:09 +0200 Original-Received: from localhost ([::1]:53297 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Usvk4-0003PK-Gw for geh-help-gnu-emacs@m.gmane.org; Sat, 29 Jun 2013 10:03:08 -0400 Original-Path: usenet.stanford.edu!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 30 Original-X-Trace: individual.net VpyZLiDlszs4uId+YrlhbQVXqdpalkhpqeS/+Ej4RNzxtvMSQu Cancel-Lock: sha1:UTnEtajCb4WQuWxxDg8+ecOBfas= User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130509 Thunderbird/17.0.6 In-Reply-To: Original-Xref: usenet.stanford.edu gnu.emacs.help:199586 X-Mailman-Approved-At: Sat, 29 Jun 2013 10:02:12 -0400 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:91853 Archived-At: 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.