From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tassilo Horn Newsgroups: gmane.emacs.devel Subject: Re: Need help with search based font-locking Date: Wed, 23 Dec 2009 12:13:07 +0100 Message-ID: <87637yj64c.fsf@thinkpad.tsdh.de> References: <877hsen0na.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 1261566815 28048 80.91.229.12 (23 Dec 2009 11:13:35 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 23 Dec 2009 11:13:35 +0000 (UTC) Cc: emacs-devel@gnu.org To: Lennart Borgman Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Dec 23 12:13:28 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 1NNP9h-0000H5-0K for ged-emacs-devel@m.gmane.org; Wed, 23 Dec 2009 12:13:25 +0100 Original-Received: from localhost ([127.0.0.1]:49011 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NNP9g-0002Ct-Jy for ged-emacs-devel@m.gmane.org; Wed, 23 Dec 2009 06:13:24 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NNP9X-0002BZ-4y for emacs-devel@gnu.org; Wed, 23 Dec 2009 06:13:15 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NNP9R-00028U-UI for emacs-devel@gnu.org; Wed, 23 Dec 2009 06:13:14 -0500 Original-Received: from [199.232.76.173] (port=57008 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NNP9R-00028E-OI for emacs-devel@gnu.org; Wed, 23 Dec 2009 06:13:09 -0500 Original-Received: from deliver.uni-koblenz.de ([141.26.64.15]:24394) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NNP9R-0006dx-9P for emacs-devel@gnu.org; Wed, 23 Dec 2009 06:13:09 -0500 Original-Received: from localhost (localhost [127.0.0.1]) by deliver.uni-koblenz.de (Postfix) with ESMTP id 433C578A32D5; Wed, 23 Dec 2009 12:13:08 +0100 (CET) Original-Received: from deliver.uni-koblenz.de ([127.0.0.1]) by localhost (deliver.uni-koblenz.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 29826-04; Wed, 23 Dec 2009 12:13:07 +0100 (CET) X-CHKRCPT: Envelopesender noch tassilo@member.fsf.org Original-Received: from thinkpad.tsdh.de (dhcp17.uni-koblenz.de [141.26.71.17]) by deliver.uni-koblenz.de (Postfix) with ESMTP id 47A5B78A3258; Wed, 23 Dec 2009 12:13:07 +0100 (CET) Mail-Copies-To: never In-Reply-To: (Lennart Borgman's message of "Tue, 22 Dec 2009 23:43:27 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.90 (gnu/linux) X-Virus-Scanned: amavisd-new at uni-koblenz.de X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) 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:118792 Archived-At: Lennart Borgman writes: Hey Lennart, >> I really tried to dig into the elisp manual, but I couldn't find any >> help with font-lock-defaults KEYWORDS that aren't fixed. > > Maybe you can use jit-lock-refontify? Hm, I have (setq font-lock-defaults '((greql-fontlock-keywords-1 greql-fontlock-keywords-2 greql-fontlock-keywords-3))) in my mode setup. Then I change the value of greql-fontlock-keywords-3 and call `jit-lock-refontify'. But it doesn't apply the new fontification. And the reason is, that font-lock-keywords isn't updated. Then I digged a bit into the font-lock code, and at least it looks like `font-lock-set-defaults' is the function I'm looking for. So now I use this: (let (font-lock-set-defaults) (font-lock-set-defaults)) (jit-lock-refontify (point-min) (point-max)) (redisplay t) When greql-fontlock-keywords-3 changes in a way, that elements that were highlighted before shouldn't be anymore, it works instantly. But the other way round doesn't. I'll demonstrate that with an example: In the GReQL language, you can import schema elements to formulate queries using shorted names. The font-locking in level 3 should highlight existing, valid element names. For example, the "Class" in V{Class} should be highlighted, because frontend.java.Class is imported: --8<---------------cut here---------------start------------->8--- import frontend.java.Class; sort( from pe : V{Class} with count(pe <--{frontend.java.PackageContainsElement}) = 0 reportSet from inner : pe -->{frontend.java.PackageContainsElement} reportSet describe(inner) end end ) --8<---------------cut here---------------end--------------->8--- When writing the import statement and saving, the fontification will eventually appear, but I need to insert a line break, so that V{Class} is on another line. Does font-lock skip unchanged lines somehow? If so, how do I change that? Bye, Tassilo