Emacs: very slow scrolling with font-lock/syntax coloring
Asked Answered
G

3

9

I'm trying to switch to Emacs from Vim for a few months and faced the strange problem: when font-lock is on, scrolling in emacs becomes very slow. Example of relevant part of config:

(require 'vimpulse)
(require 'font-lock)
(require 'color-theme)

(global-font-lock-mode 1)
;;(setq font-lock-maximum-decoration t
;;font-lock-maximum-size nil)
;;(setq font-lock-support-mode 'fast-lock-mode ; lazy-lock-mode
;;  fast-lock-cache-directories '("~/.emacs-flc"))

It's slow even on relatively small files starting with a couple of hundreds rows. Seems that this is not a very common problem, cause I did not find any clear solution so far.

GNU Emacs 23.1.1 Ubuntu 10.04

Gird answered 3/10, 2010 at 9:25 Comment(0)
J
3

Bold fonts are likely the problem.

I personally got a copy of a definition of a color-theme in my .emacs.el and changed it to get rid of much of the bold attributes. This way I got a theme I like without to much penalty.

(require 'color-theme)
(defun color-theme-youlike ()
  (interactive)
  (color-theme-install
   '(color-theme-youlike
     ((foreground-color . "black")
      (background-color . "white")
      (mouse-color . "sienna3")
      (cursor-color . "HotPink")
      (border-color . "Blue")
      (background-mode . light))
     (default ((t (nil))))
...
     (show-paren-mismatch-face ((t (:foreground "white" :background "purple")))))))
(set-default-font "Monaco-12")
(color-theme-youlike)

Hope it works for you also.

Jiggle answered 3/10, 2010 at 19:29 Comment(0)
B
0

You turned off fast and lazy locking. I think both of these were engineered to improve the responsiveness and behavior of font-lock in various scenarios. I'm curious why you'd turn them off. To learn more about that stuff, what they do and when you should use them, read the comments in the lasy-lock and font-lock.el files. (I think)

Bolingbroke answered 7/11, 2010 at 15:9 Comment(2)
FYI, emacs 23.2.1 tells me (C-h v font-lock-support-mode) that jit-lock-mode is preferred over fast-lock-mode and lazy-lock-mode.Apollonius
I've tried different combinations of fast/lazy locking, whatever. There is the version that coloring modes I've used are implemented by ineffective way: say, coloring mode for Ocaml is working slow when coloring mode for C is ok with the same options (fast/lazy and so on). Now I've just left emacs away and have returned to vim. I just need a good source code editor.Gird
V
0

You can start with 'emacs -Q', eval (global-font-lock-mode 1), and see if it still reproduces. if yes, file a bug; if no, check your installed site-lisp..

Vergne answered 30/11, 2011 at 9:36 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.