[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: |
Stefan Monnier |
Subject: |
Re: Major modes using `widen' is a good, even essential, programming practice. |
Date: |
Sun, 07 Aug 2022 19:21:32 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) |
> 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.
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).
Stefan
- Re: Why tree-sitter instead of Semantic? (was Re: CC Mode with font-lock-maximum-decoration 2), (continued)
- Re: CC Mode with font-lock-maximum-decoration 2, Alan Mackenzie, 2022/08/08
- Re: Major modes using `widen' is a good, even essential, programming practice., Gregory Heytings, 2022/08/07
- Re: Major modes using `widen' is a good, even essential, programming practice., Alan Mackenzie, 2022/08/07
- Re: Major modes using `widen' is a good, even essential, programming practice., Gregory Heytings, 2022/08/07
- Re: Major modes using `widen' is a good, even essential, programming practice., Eli Zaretskii, 2022/08/07
- Re: Major modes using `widen' is a good, even essential, programming practice., Alan Mackenzie, 2022/08/08
- 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.,
Stefan Monnier <=
- Re: Major modes using `widen' is a good, even essential, programming practice., Eli Zaretskii, 2022/08/07
- Re: Major modes using `widen' is a good, even essential, programming practice., Stefan Monnier, 2022/08/08
- Re: Major modes using `widen' is a good, even essential, programming practice., Lynn Winebarger, 2022/08/08
- 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., Lynn Winebarger, 2022/08/08
- 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., Stefan Monnier, 2022/08/08
- 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., Stefan Monnier, 2022/08/08
- Re: Major modes using `widen' is a good, even essential, programming practice., Eli Zaretskii, 2022/08/08