From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Need help with search based font-locking Date: Wed, 23 Dec 2009 22:07:10 -0500 Message-ID: References: <877hsen0na.fsf@thinkpad.tsdh.de> <87637yj64c.fsf@thinkpad.tsdh.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1261624245 32113 80.91.229.12 (24 Dec 2009 03:10:45 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 24 Dec 2009 03:10:45 +0000 (UTC) Cc: emacs-devel@gnu.org To: Lennart Borgman Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Dec 24 04:10:38 2009 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1NNe60-000394-5x for ged-emacs-devel@m.gmane.org; Thu, 24 Dec 2009 04:10:36 +0100 Original-Received: from localhost ([127.0.0.1]:39500 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NNe5z-0002Q6-TZ for ged-emacs-devel@m.gmane.org; Wed, 23 Dec 2009 22:10:35 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NNe5u-0002PS-NW for emacs-devel@gnu.org; Wed, 23 Dec 2009 22:10:30 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NNe5q-0002OH-4B for emacs-devel@gnu.org; Wed, 23 Dec 2009 22:10:30 -0500 Original-Received: from [199.232.76.173] (port=51481 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NNe5p-0002OC-VH for emacs-devel@gnu.org; Wed, 23 Dec 2009 22:10:25 -0500 Original-Received: from chene.dit.umontreal.ca ([132.204.246.20]:33210) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NNe5p-0008JK-RV for emacs-devel@gnu.org; Wed, 23 Dec 2009 22:10:25 -0500 Original-Received: from alfajor.home (faina.iro.umontreal.ca [132.204.26.177]) by chene.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id nBO3AKor028787; Wed, 23 Dec 2009 22:10:21 -0500 Original-Received: by alfajor.home (Postfix, from userid 20848) id 453C66435B; Wed, 23 Dec 2009 22:07:10 -0500 (EST) In-Reply-To: <87637yj64c.fsf@thinkpad.tsdh.de> (Tassilo Horn's message of "Wed, 23 Dec 2009 12:13:07 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.90 (gnu/linux) X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 1 Rules triggered RV3434=0 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:118802 Archived-At: > (let (font-lock-set-defaults) (font-lock-set-defaults)) > (jit-lock-refontify (point-min) (point-max)) > (redisplay t) This assumes lots of things about font-lock's implementation (including the use of jit-lock). A slightly less invasive implementation would be: (font-lock-mode -1) (kill-local-variable 'font-lock-set-defaults) (font-lock-mode 1) tho the `font-lock-set-defaults' bit is still ugly. So, I'd recommend you submit a patch which adds a new function that does the above 3 steps (call it `font-lock-refresh-all' or something), and then use that one. In your case, tho, a better option might be to change your greql-font-lock-keywords-3 so it doesn't change. See sh-font-lock-here-doc for an example of how you might be able to do that. Admittedly, this may not always work because it may depend on the order the hilighting is done (and this order is not necessarily sequential for font-lock-keywords). So you may need to move some of the work (the one that modifies the match regexp) to font-lock-syntactic-keywords (which is guaranteed to be applied sequentially). Stefan