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: Stefan Monnier
Subject: Re: Need help with search based font-locking
Date: Wed, 23 Dec 2009 22:07:10 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.90 (gnu/linux)

>   (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





reply via email to

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