[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: Thu, 29 Jul 2021 18:28:46 +0300

> From: Yuan Fu <casouri@gmail.com>
> Date: Thu, 29 Jul 2021 10:35:10 -0400
> Cc: Stephen Leake <stephen_leake@stephe-leake.org>,
>  Clément Pit-Claudel <cpitclaudel@gmail.com>,
>  Stefan Monnier <monnier@iro.umontreal.ca>,
>  emacs-devel@gnu.org
> > We don't need to know.  The Lisp program which needs to handle this
> > situation will have to figure out what is right in that case, "right"
> > in the sense that it produces the desired results after communicating
> > the changes to TS.
> The difficulty is that what tree-sitter sees must be consistent. If Emacs 
> updates tree-sitter with option 1 and lisp later choose option 2, the content 
> that tree-sitter sees is not consistent.

If that happens, it means the Lisp program which does that has a bug
that needs to be fixed.

> Anyway, I found a way that avoids this issue: the bounds of tree-sitter’s 
> visible region never changes, and the next time when lisp narrows to a 
> different region, we update tree-sitter’s bound to match that of the 
> narrowing. Here is the latest patch. If the code is not entirely 
> straightforward, I’m happy to add more comment to explain it.

I'm not sure we should do this, because it means we second-guess what
the Lisp program calling TS intends to do.  Why should we do that,
instead of leaving it to the Lisp program to DTRT?  And what happens
if our guess is wrong?

reply via email to

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