emacs-devel
[Top][All Lists]
Advanced

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

Re: Need help with search based font-locking


From: Tassilo Horn
Subject: Re: Need help with search based font-locking
Date: Wed, 23 Dec 2009 12:13:07 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.90 (gnu/linux)

Lennart Borgman <address@hidden> 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




reply via email to

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