emacs-devel
[Top][All Lists]
Advanced

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

Re: cc-mode fontification feels random


From: Daniel Colascione
Subject: Re: cc-mode fontification feels random
Date: Sun, 6 Jun 2021 13:27:08 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1

On 6/6/21 1:24 PM, Stefan Monnier wrote:
I've been thinking of a new core facility for helping modes implement this
kind of incremental buffer analysis. Basically, it works like this:
fontification logically proceeds from bob to eob in fixed-size chunks. After
each chunk, we checkpoint the state of the fontification engine in a text
property. Whenever we modify the buffer, we invalidate chunks that the
modification might have affected and proceed from the last
known-valid checkpoint.
[ I assume that what you mean by "fontification" is not literally
   placing faces (which is typically what font-lock does), but only
   a subset of that job (the subset that needs to proceed sequentially
   from BOB).  ]

You mean like what we do for `syntax-ppss` (except we keep the
checkpoint data in an alist indexed by positions, rather than in
text-properties)?
Yes, but generic.

I think it would be fairly easy to add some way to keep extra data in
`syntax-ppss-wide/narrow`.

It's more subtle than it sounds though.

First, we need to support lookahead. Fontification of region [A, B) might do
lookahead and depend on text in region [B, C).
For `syntax-propertize` we handle this via a `syntax-multiline` text
property, so that changes in the B region cause re-propertization of the
A region.

Manually placing syntax-multiline is annoying and error-prone. Can't we instead keep track of what buffer positions were actually inspected?




reply via email to

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