[Top][All Lists]

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

Re: How to add pseudo vector types

From: Eli Zaretskii
Subject: Re: How to add pseudo vector types
Date: Tue, 20 Jul 2021 19:45:21 +0300

> From: Stephen Leake <stephen_leake@stephe-leake.org>
> Cc: Yuan Fu <casouri@gmail.com>,  monnier@iro.umontreal.ca,
>   emacs-devel@gnu.org
> Date: Tue, 20 Jul 2021 09:25:11 -0700
> > In addition, Emacs records (for redisplay purposes) two places in each
> > buffer related to changes: the minimum buffer position before which no
> > changes were done since last redisplay, and the maximum buffer
> > position beyond which there were no changes.  This can also be used to
> > pass only a small part of the buffer to the parser, because the rest
> > didn't change.
> Again, the input to tree-sitter is a list of changes, not a block of
> text containing changes.

I fail to see the significance of the difference.  Surely, you could
hand it a block of text with changes to mean that this block replaces
the previous version of that block.  It might take the parser more
work to update the parse tree in this case, but if it's fast enough,
that won't be the problem.  Right?

> If the parser is in an Emacs module, so it has direct access to the
> buffer, then the hooks only need to record the buffer positions of the
> insertions and deletions, not the new text. That should be very fast.

(You are talking about the undo-list.)

But even this is wasteful: it is quite customary to delete, then
re-insert, then re-delete again, etc. several times.  So collecting
these operations will produce much more "changes" than strictly
needed.  That's why I'm trying to find a simpler, less wasteful
strategies.  Since TS is very fast, we can trade some of the speed for
simpler, more scalable design of tracking changes.

reply via email to

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