[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#59693: 29.0.50; treesitter in base buffer doesn't respond to modific
From: |
Yuan Fu |
Subject: |
bug#59693: 29.0.50; treesitter in base buffer doesn't respond to modifications in indirect buffer correctly |
Date: |
Fri, 2 Dec 2022 17:01:36 -0800 |
> On Dec 2, 2022, at 12:33 AM, Eli Zaretskii <eliz@gnu.org> wrote:
>
>> From: Yuan Fu <casouri@gmail.com>
>> Date: Thu, 1 Dec 2022 21:05:43 -0800
>> Cc: miha@kamnitnik.top,
>> 59693@debbugs.gnu.org
>>
>>> In the insdel.c hooks where you record changes to buffer text, you should
>>> see if the buffer has a base_buffer, and if so, update any parsers of the
>>> base buffer as well.
>>
>> Actually there’s a little bit of problem. When we edit the base buffer, we
>> would want to update the parsers in all of its indirect buffers as well, and
>> AFAICT there is no pointer from base buffer to the indirect buffer, only the
>> other way around.
>
> That's not the problem presented by the OP, though.
Yeah, but they are the same problem in spirit, ie, parser not updated when
base/indirect buffer receive changes.
>
>> We don’t want indirect buffer and base buffers to share parsers, since they
>> can have different narrowing, and semantically indirect buffers should share
>> anything but the text with the base buffer.
>
> Yes, the parsers should not be shared.
>
>> How about this: we change current_buffer->parser_list from a plain list of
>> parsers to a cons (PARSER-LIST . INDIRECT-PARSER-LIST), where PARSER-LIST is
>> as before. But for base buffers, INDIRECT-PARSER-LIST includes all the
>> parsers of its indirect buffers; and for indirect buffers,
>> INDIRECT-PARSER-LIST is nil.
>
> You can maybe have the indirect buffers in the list, not their parsers.
> That could make it easier to access other treesit-related information of the
> indirect buffers, if needed.
Good idea, it’s easier to know when to remove the reference with buffers, aka
when buffer is killed.
Yuan
bug#59693: 29.0.50; treesitter in base buffer doesn't respond to modifications in indirect buffer correctly, Stefan Monnier, 2022/12/04
- bug#59693: 29.0.50; treesitter in base buffer doesn't respond to modifications in indirect buffer correctly, Eli Zaretskii, 2022/12/05
- bug#59693: 29.0.50; treesitter in base buffer doesn't respond to modifications in indirect buffer correctly, Stefan Monnier, 2022/12/05
- bug#59693: 29.0.50; treesitter in base buffer doesn't respond to modifications in indirect buffer correctly, Eli Zaretskii, 2022/12/05
- bug#59693: 29.0.50; treesitter in base buffer doesn't respond to modifications in indirect buffer correctly, Stefan Monnier, 2022/12/05
- bug#59693: 29.0.50; treesitter in base buffer doesn't respond to modifications in indirect buffer correctly, Yuan Fu, 2022/12/05
- bug#59693: 29.0.50; treesitter in base buffer doesn't respond to modifications in indirect buffer correctly, Stefan Monnier, 2022/12/05