[Top][All Lists]

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

Mode-specific font lock delays

From: Björn Lindqvist
Subject: Mode-specific font lock delays
Date: Sun, 4 Sep 2016 07:01:42 +0200

Hello emacsers!

In the mode I'm working on, font locking is getting laggy when
operating on large buffers. Possibly because the regexps I've written
for highlighting aren't very good and could use some tune-up by some
experts. But it is quick enough for most buffers. So what I'm looking
for is a way to defer font-locking so that it only occurs when nothing
else is happening which should prevent emacs from becoming laggy.

I've found a few variables in the jit-lock-* namespace which I've
tried to tweak. What I've found worked the best was setting
jit-lock-defer-time to a value like 0.5-1.5 which completely
eliminates all lag. But there are two problems:

1) Changing the variable is not mode-specific, but changes how
font-lock operates on all buffers. That's not right as I want the
increased defer time to only apply to this mode's buffers.
2) When a file is opened, there is a flicker as font-lock waits for
the timeout before highlighting the buffer. It would be much better if
there was no delay for the first highlighting pass.

Can these two problems be solved? If so, how? It would be nice if
font-lock had some builtin auto-tuning so that if it notices that if
the highlighting passes are taking a long time to run, it increases
the delay between them.

mvh/best regards Björn Lindqvist

reply via email to

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