emacs-pretest-bug
[Top][All Lists]
Advanced

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

Re: perl mode color highlighting working badly


From: Stefan Monnier
Subject: Re: perl mode color highlighting working badly
Date: Mon, 10 Oct 2005 10:45:18 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

>     The problem is that in perl-mode some syntax-table text-properties are
>     set in font-lock-syntactic-keywords, while others are set in
>     font-lock-syntactic-face-function, and that font-lock+jit-lock applies
>     font-lock-syntactic-keywords to "all" the buffer but only applies
>     font-lock-syntactic-face-function to the displayed part of the buffer.

> Would it be better to apply font-lock-syntactic-face-function
> to "all" the buffer, too?

Already applying font-lock-syntactic-keywords to "all" the buffer defeats
the purpose of jit-lock.  Applying font-lock-syntactic-face-function in the
same way would defeat it even more, and this only because perl-mode uses it
in a sneaky way (perl-mode is the only mode which suffers from this
problem).

> (What is the significance of those quotes around "all"?)

font-lock-syntactic-keywords is not really applied eagerly to the whole
buffer, but only to the region between point-min and the currently visible
area.  In many cases, this is just as JIT as what happens with the rest of
the font-locking, but if you jump to the end of the buffer right after
opening it, it does indeed end up applying font-lock-syntactic-keywords
eagerly to the whole buffer while font-lock-keywords is only applied to the
last 40 lines.  This is done in font-lock-fontify-syntactic-keywords-region
with the following lines:

  ;; Ensure the beginning of the file is properly syntactic-fontified.
  (when (and font-lock-syntactically-fontified
             (< font-lock-syntactically-fontified start))
    (setq start (max font-lock-syntactically-fontified (point-min)))
    (setq font-lock-syntactically-fontified end))


-- Stefan




reply via email to

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