From: Tassilo Horn <tassilo@member.fsf.org>
To: emacs-devel@gnu.org
Subject: Need help with search based font-locking
Date: Tue, 22 Dec 2009 22:45:29 +0100 [thread overview]
Message-ID: <877hsen0na.fsf@thinkpad.tsdh.de> (raw)
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.
next reply other threads:[~2009-12-22 21:45 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-22 21:45 Tassilo Horn [this message]
2009-12-22 22:43 ` Need help with search based font-locking Lennart Borgman
2009-12-23 11:13 ` Tassilo Horn
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=877hsen0na.fsf@thinkpad.tsdh.de \
--to=tassilo@member.fsf.org \
--cc=emacs-devel@gnu.org \
/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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).