[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: Wed, 28 Jul 2021 22:00:16 +0300

> From: Yuan Fu <casouri@gmail.com>
> Date: Wed, 28 Jul 2021 14:46:03 -0400
> Cc: Stephen Leake <stephen_leake@stephe-leake.org>,
>  cpitclaudel@gmail.com,
>  monnier@iro.umontreal.ca,
>  emacs-devel@gnu.org
> > The adherence to narrowing is for the use cases where TS is _always_
> > invoked on the same narrowed region.  You seem to be thinking about
> > changes in the narrowing while TS is parsing, or between consecutive
> > re-parsing calls, but I see no interesting/important use cases which
> > would need to do that.  And if there are some tricky cases which do
> > need this, the respective Lisp programs will have to deal with the
> > problem.
> That makes sense. However it bring up a problem. Consider such a buffer: 
> XXAAXX. Say lisp narrows to AA and creates a tree-sitter parser. Then lisp 
> widens the buffer, and user inserts B in front of AA. Now the buffer is 
> XXBAAXX. Emacs has two options to convey this change to the tree-sitter 
> parser: 1) it does not, then tree-sitter still thinks the buffer is AA, 
> essentially the portion where tree-sitter sees is pushed forward by one 
> character, 2) it tells tree-sitter the user inserted a character at the 
> beginning, then tree-sitter thinks the buffer is BAA. Which option is correct 
> depends on how does lisp later narrows: if lisp narrows to AA, then option 1 
> is correct, if lisp narrows to BAA, then option 2 is correct. But how do we 
> know which option is correct before lisp narrows?

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.

reply via email to

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