[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to add pseudo vector types
From: |
Stephen Leake |
Subject: |
Re: How to add pseudo vector types |
Date: |
Wed, 21 Jul 2021 09:02:25 -0700 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (windows-nt) |
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>>> If we copy the buffer's content to a freshly malloc area before passing
>>> that to TS, then there should be no problem running TS in a separate
>>> concurrent thread, indeed.
>> Except that the results will not be useful, since they won't apply to
>> the original buffer if it is changed.
>
> Not true: we just have to keep track of the list of changes (as Yuan's
> patch does), then pass it to tree-sitter to get a tree up-to-date w.r.t
> the current content of the buffer.
The point is that more changes can happen while the parser is running.
>> And if the original buffer is not changed, then we do not need to run
>> the parser asynchronously.
>
> We do:
> - because we want to do other things in the mean time
> - because we want to take advantage of the many CPU cores sitting
> idle.
"using more cores" means parallel execution, which can still be
synchronous. That could be done for all invocations of the parser.
In the typical case of opening a new buffer, it might make sense
to spawn a thread to compute the fontification while the rest of the
major-mode-hook runs. Except functions on that hook could affect the
fontification, and not by changing the buffer; they could set the
fontification level or style.
Are there "other things" that are guaranteed to not affect
fontification?
In any case, the buffer must be read-only while the fontification is
being computed, so either the main emacs thread must wait for the
fontification to complete, or it must actually mark the buffer read-only
until the fontification completes, which could surprise the user.
On the other hand, if we don't force read-only, it might be possible to
use only part of the fontification information, up to the first change.
--
-- Stephe
- Re: How to add pseudo vector types, (continued)
- Re: How to add pseudo vector types, Stephen Leake, 2021/07/24
- Re: How to add pseudo vector types, Dmitry Gutov, 2021/07/24
- Re: How to add pseudo vector types, Stephen Leake, 2021/07/20
- Re: How to add pseudo vector types, Eli Zaretskii, 2021/07/20
- Re: How to add pseudo vector types, Stefan Monnier, 2021/07/20
- Re: How to add pseudo vector types, Stefan Monnier, 2021/07/20
- Re: How to add pseudo vector types, Clément Pit-Claudel, 2021/07/20
- Re: How to add pseudo vector types,
Stephen Leake <=
- Re: How to add pseudo vector types, Stefan Monnier, 2021/07/21
- Re: How to add pseudo vector types, Clément Pit-Claudel, 2021/07/20
- Re: How to add pseudo vector types, Eli Zaretskii, 2021/07/20
- Re: [SPAM UNSURE] Re: How to add pseudo vector types, Stephen Leake, 2021/07/21
- Re: [SPAM UNSURE] Re: How to add pseudo vector types, Clément Pit-Claudel, 2021/07/21
- Re: [SPAM UNSURE] Re: How to add pseudo vector types, Eli Zaretskii, 2021/07/21
- Re: [SPAM UNSURE] Re: How to add pseudo vector types, Clément Pit-Claudel, 2021/07/22
- Re: [SPAM UNSURE] Re: How to add pseudo vector types, Eli Zaretskii, 2021/07/22
- Re: [SPAM UNSURE] Re: How to add pseudo vector types, Clément Pit-Claudel, 2021/07/22
- Re: How to add pseudo vector types, Eli Zaretskii, 2021/07/17