emacs-devel
[Top][All Lists]
Advanced

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

Excessive refontification when setting jit-lock-context-unfontify-pos


From: Ralf Angeli
Subject: Excessive refontification when setting jit-lock-context-unfontify-pos
Date: Mon, 23 Apr 2007 21:44:52 +0200
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.96 (gnu/linux)

Hi,

in AUCTeX I am extending the region to be fontified by
`font-lock-default-fontify-region' backwards in order to cater for
large multiline constructs.  In order to force refontification with
jit-lock, `jit-lock-context-unfontify-pos' is set to the start of such
a multiline construct.  Now when this is done it seems that the
affected regions are refontified over and over again.

Here is a testcase:

(progn
  (defun my-font-lock-fontify-region (beg end &optional loudly)
    (setq jit-lock-context-unfontify-pos (- beg 1000))
    (message (format "Fontifying ... (buffer: %s, beg: %d)"
                     (prin1-to-string (current-buffer)) beg))
    (font-lock-default-fontify-region beg end loudly))
  (find-library "lisp-mode")
  (setq font-lock-fontify-region-function 'my-font-lock-fontify-region))

After executing the form lisp-mode.el should be opened and the
`font-lock-fontify-region-function' will be set to the new one defined
in the code which always sets `jit-lock-context-unfontify-pos'.  If
you now scroll to the bottom of the buffer with `C-v' the function
obviously gets called a lot.  But once the bottom of the buffer is
reached I'd expect that to stop unless something changed in the
buffer.  However, only some activity like scrolling or activating the
minibuffer will make the fontification function be called again.

This does not happen in Emacs 21, so it looks like this is a
regression.  I got a bit tangled up in the font-lock and jit-lock code
and hope that somebody has an idea of what might be going wrong.

-- 
Ralf





reply via email to

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