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: Tue, 01 Nov 2005 14:01:35 -0500
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

> As far as I understand `font-lock-syntactically-fontified' is not reset
> after a buffer change.

Yes.  That can be a problem if text before window-start is modified.
But such situations are pretty rare.  I hope this can wait until we move the
syntactic-fontification to syntax.el where it will be solved much
more cleanly.

> Hence `font-lock-fontify-syntactically-region'
> and `font-lock-fontify-syntactic-keywords-region' might fail both after
> a buffer has been modified.  I believe that `jit-lock-after-change'
> should contain something like

>         (setq font-lock-syntactically-fontified
>               (min font-lock-syntactically-fontified start))

Note that jit-lock is supposed to be a generic framework used by packages
such as font-lock (and glasses-mode).  So adding font-lock specific code to
it is ugly.

> Moreover I don't know what `font-lock-syntax-props-depend-on-themselves'
> is needed for.

When you figure out what it's for, could you give me some hint about how the
docstring needs to be improved?

Here is an example.  Let's say you have already fontified the whole buffer,
and the following things happen:
- someone modifies text between positions 50 and 60.
- font-lock-fontify-region is called on 50..60.  The syntax-ppss state
  at position 60 may be different from what it used to be because
  syntactic-keywords may have added some syntax-table properties.
- font-lock-fontify-region is called on 100..200.
  If font-lock-syntactic-keywords uses syntax-ppss, that means that the
  syntax-table properties placed on the text between 60-100 may depend on the
  syntax-ppss state at position 60.  So in order to get the correct
  syntax-ppss at position 100, we should re-apply syntactic-keywords between
  60 and 100.

> Finally, doing `font-lock-fontify-syntactically-region' from `sbeg'
> without doing a `font-lock-fontify-keywords-region' from `sbeg' too
> seems problematic.

Yes, I'm not very confortable with this either.  I think the
font-lock-syntax-props-depend-on-themselves thingy is OK, but the
font-lock-fontify-syntactically-eagerly is more of a hack to get
perl-mode working.


        Stefan




reply via email to

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