[Pkg-exppsy-maintainers] rst-mode responsiveness

Greg Detre (gdetre@Princeton.EDU) gdetre at Princeton.EDU
Wed Feb 27 04:03:55 UTC 2008


this goes out to all the emacs users in the house. if you're using emacs 22, the rst-mode that ships may be broken. this might be fixed in debian by now for all i know, but i ended up just grabbing the latest rst-mode.el from source

the problem was that rst-mode is slow to fontify (i.e. apply syntax coloring), and so it made use of lazy-lock-mode. this is a clever hack that tells emacs to wait until it's been idle for a while before attempting to fontify, ensuring that emacs you get the best of both worlds in terms of responsiveness and fontification (after half a second).

anyway, to cut a long story down to a fairly long story, lazy-lock-mode has been deprecated in emacs 22, to be replaced by jit-lock-mode.

if you add the following lines to your .emacs file:

                       (setq jit-lock-context-time 5)
                       (setq jit-lock-defer-time .5)
                       (setq jit-lock-stealth-time 10)
                       (setq jit-lock-stealth-verbose nil)
                       (setq jit-lock-stealth-nice 0.5)
                       (setq jit-lock-stealth-load 10)
                       (setq jit-lock-chunk-size 50)

you should find that jit-lock-mode will now be turned on, and editing in rst-mode will be less painful.

some caveats:

- this may be unnecessary if rst-mode has been fixed to automatically use jit-lock-mode

- i figured those parameters out by trial and error since i didn't like the defaults, and i wanted things to be very responsive and not use up my cpu in the background. i'd be interested to hear from anyone who thinks they've found better ones

- i haven't figured out how to set jit-lock-mode for just a single mode yet, so this will affect every mode that has syntax highlighting...

g



More information about the Pkg-exppsy-maintainers mailing list