[Top][All Lists]

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

Re: Major modes using `widen' is a good, even essential, programming pra

From: Alan Mackenzie
Subject: Re: Major modes using `widen' is a good, even essential, programming practice.
Date: Sun, 7 Aug 2022 14:59:06 +0000

Hello, Eli.

On Sun, Aug 07, 2022 at 17:20:52 +0300, Eli Zaretskii wrote:
> > Date: Sun, 7 Aug 2022 14:13:36 +0000
> > Cc: emacs-devel@gnu.org
> > From: Alan Mackenzie <acm@muc.de>

> > > jit-lock-functions is an API, with a contract.  CC Mode decided to break 
> > > that contract.

> > Where, exactly are the terms of this supposed contract formulated?  And
> > which part of this supposed contract has CC Mode broken?

> jit-lock calls the functions with two arguments, BEG and END, and
> expects them to work only on that chunk of text.

I don't think you really mean that.  Consider the second jit-lock chunk
at the beginning of xdisp.c.  Fontifying that chunk involves looking
back 1500 characters before BEG to see that it needs
font-lock-comment-face.  You might argue that that information will be
in a cache anyway, but that's not dependable.

Also, the (BEG END) region will typically get rounded up to whole lines,
again "violating" that chunk.  In principle, font-lock needs to look
outside of (BEG END).

> > If you find CC Mode too sluggish for you (I don't), then configure it to
> > be faster and inaccurate by setting font-lock-maximum-decoration.

> It doesn't help, IME.  The mode is still slow.

OK, I need to look at CC Mode with f-l-m-d 2.  There are surely things
which can be taken out of that.

Alan Mackenzie (Nuremberg, Germany).

reply via email to

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