[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Need help with search based font-locking
From: |
Tassilo Horn |
Subject: |
Need help with search based font-locking |
Date: |
Tue, 22 Dec 2009 22:45:29 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.1.90 (gnu/linux) |
Hi all,
in my greql-mode [1], I setup font-locking like that:
--8<---------------cut here---------------start------------->8---
(define-derived-mode greql-mode text-mode "GReQL"
"A major mode for GReQL2."
[...]
(setq font-lock-defaults
'((greql-fontlock-keywords-1
greql-fontlock-keywords-2
greql-fontlock-keywords-3)))
(add-hook 'after-save-hook 'greql-set-fontlock-keywords-3 t t)
[...]
(define-key greql-mode-map (kbd "C-c C-f") 'greql-format))
--8<---------------cut here---------------end--------------->8---
`greql-fontlock-keywords-3's value is not static, it frequently changes.
So I update it after saving (as you can see), and at several other
places. The updating of the variable works, but how do I tell font-lock
that it should use the new value and re-fontify the current buffer?
As a brute-force workaround, I can do
(set (make-local-variable 'font-lock-keywords)
greql-fontlock-keywords-3)
(redisplay t)
but I guess this is very bad style. And even then some things that
should be highlighted are not. For those, I need to delete a char and
add it back to apply the new fontification.
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.
Thanks for help!
Tassilo
__________
[1] GReQL is a graph query language developed at our institute.
- Need help with search based font-locking,
Tassilo Horn <=
- Re: Need help with search based font-locking, Lennart Borgman, 2009/12/22
- Re: Need help with search based font-locking, Tassilo Horn, 2009/12/23
- Re: Need help with search based font-locking, Tassilo Horn, 2009/12/23
- Re: Need help with search based font-locking, Stefan Monnier, 2009/12/23
- Re: Need help with search based font-locking, Lennart Borgman, 2009/12/23
- Re: Need help with search based font-locking, Stefan Monnier, 2009/12/23
- Re: Need help with search based font-locking, Lennart Borgman, 2009/12/24
- Re: Need help with search based font-locking, Tassilo Horn, 2009/12/28
- Re: Need help with search based font-locking, Lennart Borgman, 2009/12/28
- Re: Need help with search based font-locking, Tassilo Horn, 2009/12/28