Why not enable font lock by default?

Ville Skyttä scop at xemacs.org
Thu Jul 12 16:04:09 EDT 2007


On Friday 06 July 2007, Jason Spiro wrote:
> 2007/7/3, Mike Kupfer <mike.kupfer at sun.com>:
> > The one concern that I have about enabling font lock by default is that
> > it can be slow, i.e., when editing large files on relatively slow
> > hardware.
>
> If somebody feels it is too slow for them, they can disable it using
> the drop-down menus or using M-x customize.  But the vast majority of
> people would benefit from it.  :-)

My late .02€ to the discussion: MHO is that plain vanilla font-lock is too 
slow to be enabled by default.  But I wouldn't object at all to lazy-lock 
enabling font-lock and itself automatically when installed, provided that 
there's a sane way to do it without trumping the user's choices such as 
preference of lazy-shot over lazy-lock, or preference to have no font-lock 
and no lazy-lock and friends no matter if they're installed or not.

I'm actually trying something like this out in the latest Fedora devel XEmacs 
packages with this in site-start.el:

(setq-default lazy-lock-minimum-size (* 2 1024))

...and this in default.el:

(require 'font-lock)
(when (fboundp 'turn-on-lazy-lock)
  ;; use lazy-lock by default if lazy-shot is not enabled
  (remove-hook 'font-lock-mode-hook 'turn-on-lazy-lock)
  (add-hook 'font-lock-mode-hook
            (function
             (lambda ()
               (unless (and (boundp 'lazy-shot-mode) lazy-shot-mode)
                 (turn-on-lazy-lock))))
            t))

Users who don't want font locking auto-enabled this way can set 
inhibit-default-init to t.

Hm, actually I should probably make the "(require 'font-lock)" happen only 
when turn-on-lazy-lock is bound to have the above accomplish what I mean.



More information about the XEmacs-Beta mailing list