emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [Emacs-orgmode] Autocollapse of outline nodes


From: Carsten Dominik
Subject: Re: [Emacs-orgmode] Autocollapse of outline nodes
Date: Wed, 26 Apr 2006 11:20:15 +0200

On Apr 24, 2006, at 14:15, Piotr Zielinski wrote:

Hi,

Here's a small piece of code that periodically collapses all org nodes
(trees) which are far away (structurally) from the current cursor
position.  The purpose is to automatically collapse nodes which you
are no longer working on, thereby preventing uncontrolled growth of
the visible size of your .org buffer as the day progresses.
very interesting idea / piece of code.

One potential problem that I see is that (point) is a property of a window. Only if a buffer is shown in one or zero windows, then (point) is unique after a set-buffer operation for this buffer and you can use it to select which part not to hide.
So what might happen is that you can have two or more windows on a 
buffer (in the same frame, or even on different frames), each looking 
at a different section of the outline tree.  I often do this when 
restructuring a file, while moving stuff from one place in a file to 
another.  Your code would keep closing some of the visible outlines, 
because it only considers (point) in a single window (I don't even know 
which one if would actually use in this case, an interesting problem).  
To solve this, you would need to check if a buffer is displayed in 
several places, make a list of (point) in all these places, and then 
check is any of the listed values of point fall in the outline subtree 
you are about to close.
Finally, you are running it on an idle timer with 60 seconds of idle 
time required.  I would be interesting how this works in pratice, and 
if this is the best way to activate this code.  For now, I have not 
tried it extensively and I don't know.
- Carsten



--
Carsten Dominik
Sterrenkundig Instituut "Anton Pannekoek"
Universiteit van Amsterdam
Kruislaan 403
NL-1098SJ Amsterdam
phone: +31 20 525 7477





reply via email to

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