[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Exposing buffer text modifications to Lisp (was: Tree-sitter integra
From: |
Ihor Radchenko |
Subject: |
Re: Exposing buffer text modifications to Lisp (was: Tree-sitter integration on feature/tree-sitter) |
Date: |
Sat, 18 Jun 2022 15:23:51 +0800 |
Eli Zaretskii <eliz@gnu.org> writes:
>> (headline
>> (:raw-value "test headline" :begin 292 :end 314 ... :tags ("tag") ...
>> :parent (...))
>> ;; no children
>> )
>>
>> Upon modifying text inside the headline, we need to update :begin/:end
>> properties to reflect the new headline boundaries in buffer and possibly
>> update headline properties (e.g. :tags).
>>
>> The same should be done for all the elements containing the headline.
>
> Where you care about changes in buffer positions of the AST elements,
> markers should take care of most, if not all, of them. I presume you
> already do use markers wherever possible? if not, why not? Or what am
> I missing?
Because lots of markers degrade Emacs regex search performance
tremendously.
See https://list.orgmode.org/orgmode/scedec$2g0$1@ciao.gmane.io/
and https://orgmode.org/list/87y21wkdwu.fsf@localhost
>> Missing any significant change (the one involving terminal symbols or
>> changing region length) will make the AST invalid.
>
> Why would you miss significant changes if you base your implementation
> on buffer-modification hooks? If there are some situations where
> buffer text is modified in ways that are significant for the update
> of the AST, but buffer-modification hooks are NOT called, please
> describe some of those situations, so we will have something concrete
> to talk about.
The situation is third-party code doing bloody murder with
(with-silent-modifications
(insert "Some text not triggering modification hooks))
Another scenario is modifying text in indirect buffers created with
make-indirect-buffer. (where there is no chance to install
before/after-change-functions via clone-indirect-buffer-hook).
Best,
Ihor
- Lower-level change hook immune to with-silent-modifications, (continued)
Re: Tree-sitter integration on feature/tree-sitter, Eli Zaretskii, 2022/06/17
- Re: Tree-sitter integration on feature/tree-sitter, Ihor Radchenko, 2022/06/17
- Re: Exposing buffer text modifications to Lisp (was: Tree-sitter integration on feature/tree-sitter), Eli Zaretskii, 2022/06/17
- Re: Exposing buffer text modifications to Lisp (was: Tree-sitter integration on feature/tree-sitter), Ihor Radchenko, 2022/06/18
- Re: Exposing buffer text modifications to Lisp (was: Tree-sitter integration on feature/tree-sitter), Eli Zaretskii, 2022/06/18
- Re: Exposing buffer text modifications to Lisp (was: Tree-sitter integration on feature/tree-sitter),
Ihor Radchenko <=
- Re: Exposing buffer text modifications to Lisp (was: Tree-sitter integration on feature/tree-sitter), Eli Zaretskii, 2022/06/18
- Re: Exposing buffer text modifications to Lisp (was: Tree-sitter integration on feature/tree-sitter), Ihor Radchenko, 2022/06/18
- Re: Exposing buffer text modifications to Lisp, Eli Zaretskii, 2022/06/18
- Re: Exposing buffer text modifications to Lisp, Ihor Radchenko, 2022/06/20
- Re: Exposing buffer text modifications to Lisp, Eli Zaretskii, 2022/06/20
- Re: Exposing buffer text modifications to Lisp, Stefan Kangas, 2022/06/20
- Re: Exposing buffer text modifications to Lisp, Ihor Radchenko, 2022/06/20
Re: Exposing buffer text modifications to Lisp, Ihor Radchenko, 2022/06/21
Re: Exposing buffer text modifications to Lisp, Eli Zaretskii, 2022/06/21
Optimizing performance of buffer markers (was: Exposing buffer text modifications to Lisp), Ihor Radchenko, 2022/06/25