emacs-devel
[Top][All Lists]
Advanced

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

Re: Question: add-face-text-property for 'font-lock-face?


From: Qiantan Hong
Subject: Re: Question: add-face-text-property for 'font-lock-face?
Date: Mon, 30 Aug 2021 00:41:15 +0000

> IIRC we have pretty much exactly that need in outline.el where we use
> overlays to put an `invisible` property.  See `outline-flag-region`.
> AFAICT this code currently doesn't try and merge overlays upon
> insertion, but it shouldn't be hard to add that functionality.
It seems that outline.el always call outline-flag-region on chunk of texts
(an entry, a subtree, etc). On the other hand crdt.el need to add property
to every modification received from remote peer, lots of them will contain
only single character. Therefore I don’t performance concern is hypothetical
for naive handling (without overlay merging). This can easily result in
> 10k overlays in the worst case for a medium sized buffer.

> The performance concern is largely hypothetical, and if it ever proves
> real, we have a branch waiting to be merged that reimplement overlays
> in a more efficient (algorithmically) way.
Thanks for the information. I’ll implement using overlay+merging then.
It will probably work for most cases for now, and let that branch fix
the pathological case where user inputs largely interleaves in the future.
(The case sounds implausible, but it could happen, e.g. when
using crdt.el to share an artist-mode buffer)

reply via email to

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