[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: |
Mon, 8 Aug 2022 10:38:36 +0000 |
Hello, Stefan.
On Sun, Aug 07, 2022 at 19:21:32 -0400, Stefan Monnier wrote:
> > Where, exactly are the terms of this supposed contract formulated?
> I'm not sure it's written anywhere.
> More specifically, for `jit-lock-functions`, the contract is not
> very constraining.
> For font-lock the contract is not still very explicit but is more
> constraining in that we expect major modes not to look before point-min
> or after point-max. For that reason font-lock normally widens the
> buffer before it does anything else (unless `font-lock-dont-widen` is
> set).
> > And which part of this supposed contract has CC Mode broken?
> It calls `widen` within its font-lock code.
I can't remember exactly why CC Mode widens here (though I could surely
find it in my notes), but it should be largely harmless in normal
buffers.
> Eli Zaretskii [2022-08-07 17:20:52] wrote:
> > jit-lock calls the functions with two arguments, BEG and END, and
> > expects them to work only on that chunk of text.
> That is not the case: it expects the function to "fontify" *at least*
> from BEG to END, but is quite happy to let it fontify more (and the
> function can return a value indicating which portion was actually
> returned in that case). Furthermore, it's clear that fontification of
> BEG..END may need to look at text before BEG (and occasionally beyond
> END as well).
It's also worth pointing out that _looking_ at text, whatever that means
exactly, is an order of magnitude faster than _fontifying_ that text.
> Stefan
--
Alan Mackenzie (Nuremberg, Germany).
- Re: Major modes using `widen' is a good, even essential, programming practice., (continued)
- Re: Major modes using `widen' is a good, even essential, programming practice., Dmitry Gutov, 2022/08/08
- Re: Major modes using `widen' is a good, even essential, programming practice., Eli Zaretskii, 2022/08/09
- Re: Major modes using `widen' is a good, even essential, programming practice., Dmitry Gutov, 2022/08/09
- Re: Major modes using `widen' is a good, even essential, programming practice., Eli Zaretskii, 2022/08/09
- Re: Major modes using `widen' is a good, even essential, programming practice., Dmitry Gutov, 2022/08/09
- Re: Major modes using `widen' is a good, even essential, programming practice., Eli Zaretskii, 2022/08/09
- Re: Major modes using `widen' is a good, even essential, programming practice., Dmitry Gutov, 2022/08/09
- Re: Major modes using `widen' is a good, even essential, programming practice., Gregory Heytings, 2022/08/09
- Re: Major modes using `widen' is a good, even essential, programming practice.,
Alan Mackenzie <=
- Re: Major modes using `widen' is a good, even essential, programming practice., Eli Zaretskii, 2022/08/08
- Re: Major modes using `widen' is a good, even essential, programming practice., Gregory Heytings, 2022/08/08
Re: Major modes using `widen' is a good, even essential, programming practice., Dmitry Gutov, 2022/08/07