emacs-devel
[Top][All Lists]
Advanced

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

Re: A question about overlays and performance.


From: Ihor Radchenko
Subject: Re: A question about overlays and performance.
Date: Wed, 29 Jul 2020 09:52:37 +0800

> It's interesting that you are working to change org's overlays back to
> text properties, while I'm considering doing exactly the opposite for
> the project that I've been playing with.

Org is using overlays to fold anything right now, same as outline-mode.
What do you mean by "exactly the opposite"?

If you need some specific feature that is lacking in text properties,
but present in overlays, let me know here or jump into the patch
discussion:
https://www.mail-archive.com/emacs-orgmode@gnu.org/msg127740.html 

> Do org buffers routinely wind up with thousands of overlays?

It is very common when you have an org file with thousands of headlines
each containing a [folded] property drawer. I provided an example org
file in the patch discussion:
https://www.mail-archive.com/emacs-orgmode@gnu.org/msg127740.html 

> From what little I've seen of them, I'm quite inclined to agree with
> Stefan's opinion about indirect buffers.  Is their main use in org to
> provide multiple views of a buffer with different foldings?

Another common use is narrowing to subtrees, so that you have two
buffers with different narrowing for the same org file. It is not
possible within a single buffer, as far I as know.

> I wonder if it might be possible to implement a "window-invisibility-spec",
> that would override the buffer-spec when set.  It would have to be done
> in C, not lisp.  You might even want to add a new field in the window
> structure.  I have no real clue as to whether this is possible, feasible,
> or a good idea.  But it might provide a nice way to display a single buffer
> in two different windows with different levels of hidden text.  It seems
> like it would be a lot simpler than using indirect buffers, but I'm
> certainly no expert on this.

I do not think that it is a good idea for this spefic case.

If I understand correctly, the only advantage of such approach would the
fact that you do not need to create an indirect buffer. However, there
is a problem with "window-local" approach. Anything that is
"window-local" implies that it can affect **any** buffer shown in that
window. So, we will need to handle buffer changes without adding any
extra benefit in comparison with indirect buffer approach. Not to
mention, that the ability to have independent narrow states will be
lost. 

Best,
Ihor

Jeff Norden <jnorden@tntech.edu> writes:

>> I am currently working on re-implementing org-mode folding from using
>> overlays to text-properties.
>
> It's interesting that you are working to change org's overlays back to
> text properties, while I'm considering doing exactly the opposite for
> the project that I've been playing with.  Do org buffers routinely wind
> up with thousands of overlays?
>
>> Stefan Monnier <monnier@iro.umontreal.ca> writes:
>>> ...
>>> And the way I recommend to avoid this problem is to stay clear of
>>> indirect buffers (which I consider as an attractive nuisance).
>
> From what little I've seen of them, I'm quite inclined to agree with
> Stefan's opinion about indirect buffers.  Is their main use in org to
> provide multiple views of a buffer with different foldings?
>
> I wonder if it might be possible to implement a "window-invisibility-spec",
> that would override the buffer-spec when set.  It would have to be done
> in C, not lisp.  You might even want to add a new field in the window
> structure.  I have no real clue as to whether this is possible, feasible,
> or a good idea.  But it might provide a nice way to display a single buffer
> in two different windows with different levels of hidden text.  It seems
> like it would be a lot simpler than using indirect buffers, but I'm
> certainly no expert on this.
>
> Regards,
> -Jeff

-- 
Ihor Radchenko,
PhD,
Center for Advancing Materials Performance from the Nanoscale (CAMP-nano)
State Key Laboratory for Mechanical Behavior of Materials, Xi'an Jiaotong 
University, Xi'an, China
Email: yantar92@gmail.com, ihor_radchenko@alumni.sutd.edu.sg



reply via email to

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