From: Tassilo Horn <tassilo@member.fsf.org>
To: Lennart Borgman <lennart.borgman@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: Need help with search based font-locking
Date: Wed, 23 Dec 2009 12:13:07 +0100 [thread overview]
Message-ID: <87637yj64c.fsf@thinkpad.tsdh.de> (raw)
In-Reply-To: <e01d8a50912221443i726874c0u83b540b7101f6b36@mail.gmail.com> (Lennart Borgman's message of "Tue, 22 Dec 2009 23:43:27 +0100")
Lennart Borgman <lennart.borgman@gmail.com> 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
next prev parent reply other threads:[~2009-12-23 11:13 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-22 21:45 Need help with search based font-locking Tassilo Horn
2009-12-22 22:43 ` Lennart Borgman
2009-12-23 11:13 ` Tassilo Horn [this message]
2009-12-23 11:38 ` Tassilo Horn
2009-12-24 3:07 ` Stefan Monnier
2009-12-24 3:45 ` Lennart Borgman
2009-12-24 4:46 ` Stefan Monnier
2009-12-24 13:48 ` Lennart Borgman
2009-12-28 13:20 ` Tassilo Horn
2009-12-28 13:54 ` Lennart Borgman
2009-12-28 18:18 ` Tassilo Horn
2009-12-30 13:56 ` Tassilo Horn
2009-12-30 15:29 ` Stefan Monnier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87637yj64c.fsf@thinkpad.tsdh.de \
--to=tassilo@member.fsf.org \
--cc=emacs-devel@gnu.org \
--cc=lennart.borgman@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.