[Top][All Lists]

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

Defer jit-lock on a per-buffer basis

From: Tassilo Horn
Subject: Defer jit-lock on a per-buffer basis
Date: Thu, 15 Nov 2012 10:29:56 +0100
User-agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.3.50 (gnu/linux)

Hi all,

recently this blog post

suggested to set `jit-lock-defer-time' to some small fraction to defer
jit-lock fontification a bit.  This has an enormous effect for example
when scrolling in large c-mode buffers.

However, most of the time I work with buffers that are rather small and
instant fontification is fast enough.  There, deferring font-lock is
somewhat distracting.

So is there a way to enable deferred jit-lock on a per-buffer basis?

I tried this:

  (defun th-jit-lock-defer-fontification ()
    (set (make-local-variable 'jit-lock-defer-time) 0.1)
    (font-lock-mode -1)
    (font-lock-mode 1))

In fact, when I execute that command, the variable is buffer-local, and
jit-lock is deferred as it should.  But it is actually deferred in *all*
buffers!  Even disabling and re-enabling font-lock-mode in a buffer that
doesn't have a buffer-local value of `jit-lock-defer-time' doesn't make
fontification instant again...

Any ideas?


reply via email to

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