emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Restored previous folded state after buffer opened again?
@ 2009-07-25 18:06 User
  2009-07-25 18:57 ` Matthew Lundin
  2009-07-25 19:14 ` Bastien
  0 siblings, 2 replies; 14+ messages in thread
From: User @ 2009-07-25 18:06 UTC (permalink / raw)
  To: emacs-orgmode

Is there a way to do it? I use saveplace.el which puts me back to
the position where I was last time. I use nofold, so the place is
not hidden when opening the file. Currently, I'm satisfied with
this setup, but it would even be nicer if the previous folded
state was also restored.

Does org-mode have support for that?

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Restored previous folded state after buffer opened again?
  2009-07-25 18:06 Restored previous folded state after buffer opened again? User
@ 2009-07-25 18:57 ` Matthew Lundin
  2009-07-25 19:14 ` Bastien
  1 sibling, 0 replies; 14+ messages in thread
From: Matthew Lundin @ 2009-07-25 18:57 UTC (permalink / raw)
  To: User; +Cc: emacs-orgmode

User <spamfilteraccount@gmail.com> writes:

> Is there a way to do it? I use saveplace.el which puts me back to
> the position where I was last time. I use nofold, so the place is
> not hidden when opening the file. Currently, I'm satisfied with
> this setup, but it would even be nicer if the previous folded
> state was also restored.
>
> Does org-mode have support for that?

No. Org-mode does not automatically save and restore the fold-state of a
file.

However, you can specify a default fold-state for particular
trees/subtrees by using the visibility property. See:

http://orgmode.org/manual/index.html#Visibility-cycling

Best,
Matt

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Restored previous folded state after buffer opened again?
  2009-07-25 18:06 Restored previous folded state after buffer opened again? User
  2009-07-25 18:57 ` Matthew Lundin
@ 2009-07-25 19:14 ` Bastien
  2009-07-25 19:34   ` Restore previous folded state of org buffer User
  1 sibling, 1 reply; 14+ messages in thread
From: Bastien @ 2009-07-25 19:14 UTC (permalink / raw)
  To: User; +Cc: emacs-orgmode

User <spamfilteraccount@gmail.com> writes:

> Is there a way to do it? I use saveplace.el which puts me back to
> the position where I was last time. I use nofold, so the place is
> not hidden when opening the file. Currently, I'm satisfied with
> this setup, but it would even be nicer if the previous folded
> state was also restored.
>
> Does org-mode have support for that?

Nope.  As this is becoming a FAQ, I've added this sad answer to the
org-faq.org file in Worg.

-- 
 Bastien

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Restore previous folded state of org buffer
  2009-07-25 19:14 ` Bastien
@ 2009-07-25 19:34   ` User
  2009-07-25 22:28     ` Bastien
  2009-07-26  0:05     ` Eric S Fraga
  0 siblings, 2 replies; 14+ messages in thread
From: User @ 2009-07-25 19:34 UTC (permalink / raw)
  To: emacs-orgmode

Bastien <bastienguerry <at> googlemail.com> writes:
> 
> Nope.  As this is becoming a FAQ, I've added this sad answer to the
> org-faq.org file in Worg.
> 

I don't need this feature at the moment, but the problem
intrigued me, so I came up with a quick implementation.

I don't plan to work on it further, since I don't really need it
yet (I'm a novice org user), but I put it here if someone wants
to develop the idea.

You simply load the elisp file and from that on folding state is
automatically saved and restored for org mode files. The folding
information is saved at the end of the org file itself every time
the buffer is saved.

It seemed to work pretty well. The only faulty case I discovered
is when the very last branch is folded in the file, because it
contains the saved folding info, but this bug is probably easy to
fix with a little thinking.

Here it is. I hope someone takes the idea further:


http://www.emacswiki.org/emacs/orgfold.el

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Restore previous folded state of org buffer
  2009-07-25 19:34   ` Restore previous folded state of org buffer User
@ 2009-07-25 22:28     ` Bastien
  2009-07-26  7:04       ` User
  2009-07-26  0:05     ` Eric S Fraga
  1 sibling, 1 reply; 14+ messages in thread
From: Bastien @ 2009-07-25 22:28 UTC (permalink / raw)
  To: User; +Cc: emacs-orgmode

User <spamfilteraccount@gmail.com> writes:

> I don't need this feature at the moment, but the problem
> intrigued me, so I came up with a quick implementation.

Great!

> I don't plan to work on it further, since I don't really need it
> yet (I'm a novice org user), but I put it here if someone wants
> to develop the idea.
>
> You simply load the elisp file and from that on folding state is
> automatically saved and restored for org mode files. The folding
> information is saved at the end of the org file itself every time
> the buffer is saved.
>
> It seemed to work pretty well. The only faulty case I discovered
> is when the very last branch is folded in the file, because it
> contains the saved folding info, but this bug is probably easy to
> fix with a little thinking.

Yes, I found this bug.  

One way to work around this limitation and to safely store the folding
information would be to put it in a face property for each headline.  
Perhaps you have time to dig into that direction?

Thanks for this proof-of-concept!

-- 
 Bastien

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Restore previous folded state of org buffer
  2009-07-25 19:34   ` Restore previous folded state of org buffer User
  2009-07-25 22:28     ` Bastien
@ 2009-07-26  0:05     ` Eric S Fraga
  1 sibling, 0 replies; 14+ messages in thread
From: Eric S Fraga @ 2009-07-26  0:05 UTC (permalink / raw)
  To: User; +Cc: emacs-orgmode

At Sat, 25 Jul 2009 19:34:01 +0000 (UTC), User wrote:

[...]

> You simply load the elisp file and from that on folding state is
> automatically saved and restored for org mode files. The folding
> information is saved at the end of the org file itself every time
> the buffer is saved.

I wonder if it would be useful to have this information as an org-mode
COMMENT entry?  Otherwise, functions like exporting etc will get
messed up?

Looks useful otherwise! Thanks,
eric

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Restore previous folded state of org buffer
  2009-07-25 22:28     ` Bastien
@ 2009-07-26  7:04       ` User
  2009-07-26 17:22         ` User
  0 siblings, 1 reply; 14+ messages in thread
From: User @ 2009-07-26  7:04 UTC (permalink / raw)
  To: emacs-orgmode

Bastien <bastienguerry <at> googlemail.com> writes:
> 
> One way to work around this limitation and to safely store the folding
> information would be to put it in a face property for each headline.  
> Perhaps you have time to dig into that direction?

Unfortunately, I have more pressing matters to deal with
currently, but I also have a possible solution if someone has a a
little time to fix the package.

The folding information should simply be saved into a separate
file. For example, for notes.org the accompanying folding
information could be in notes.org.fold. The posted code can be
trivially modified to behave this way and with this change the
actual content of the org file is not affected at all and we have
a pretty usable folding save/restore extension for org.

This could be another advantage of org over other packages, since
this feature is pretty basic in my opinion and users usually look
for something like this.


P.S. If saving to a separate file is implemented then it is not
necessary to trigger storing of folding info with the save
hook. The user sometimes doesn't modify the file, only browses
it, so saving fold info when the buffer is closed would be the
perfect solution.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Restore previous folded state of org buffer
  2009-07-26  7:04       ` User
@ 2009-07-26 17:22         ` User
  2009-07-26 18:50           ` Bastien
  2009-08-03  4:34           ` Carsten Dominik
  0 siblings, 2 replies; 14+ messages in thread
From: User @ 2009-07-26 17:22 UTC (permalink / raw)
  To: emacs-orgmode

User <spamfilteraccount <at> gmail.com> writes:
> 
> The folding information should simply be saved into a separate
> file. For example, for notes.org the accompanying folding
> information could be in notes.org.fold. The posted code can be
> trivially modified to behave this way and with this change the
> actual content of the org file is not affected at all and we have
> a pretty usable folding save/restore extension for org.


The thing pestered me, so I fixed it to take care of it.

Now folding information is saved into a separate file and it is
saved when the buffer is closed (but only if the buffer is saved
to disk to avoid saving folding info for discarded buffers).

I fixed the algorithm too, because it was buggy. Now it's working
well and it's also simpler.


http://www.emacswiki.org/emacs/orgfold-separate-file.el

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Re: Restore previous folded state of org buffer
  2009-07-26 17:22         ` User
@ 2009-07-26 18:50           ` Bastien
  2009-07-26 19:14             ` User
  2009-08-03  4:34           ` Carsten Dominik
  1 sibling, 1 reply; 14+ messages in thread
From: Bastien @ 2009-07-26 18:50 UTC (permalink / raw)
  To: User; +Cc: emacs-orgmode

User <spamfilteraccount@gmail.com> writes:

> User <spamfilteraccount <at> gmail.com> writes:
>> 
>> The folding information should simply be saved into a separate
>> file. For example, for notes.org the accompanying folding
>> information could be in notes.org.fold. The posted code can be
>> trivially modified to behave this way and with this change the
>> actual content of the org file is not affected at all and we have
>> a pretty usable folding save/restore extension for org.
>
>
> The thing pestered me, so I fixed it to take care of it.
>
> Now folding information is saved into a separate file and it is
> saved when the buffer is closed (but only if the buffer is saved
> to disk to avoid saving folding info for discarded buffers).
>
> I fixed the algorithm too, because it was buggy. Now it's working
> well and it's also simpler.

Hey, that's nice.  

I was just about to suggest:  "Why not using a  VISIBILITY property
for that?" (that would spare us the additional file..) but you were
faster than me!  :)

Thanks for this,

-- 
 Bastien

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Restore previous folded state of org buffer
  2009-07-26 18:50           ` Bastien
@ 2009-07-26 19:14             ` User
  2009-07-26 19:24               ` Bastien
  0 siblings, 1 reply; 14+ messages in thread
From: User @ 2009-07-26 19:14 UTC (permalink / raw)
  To: emacs-orgmode

Bastien <bastienguerry <at> googlemail.com> writes:
> 
> I was just about to suggest:  "Why not using a  VISIBILITY property
> for that?" (that would spare us the additional file..) but you were
> faster than me!  :)
> 

Ah, yes. Properties. Being a new user I haven't yet used them,
so they didn't occur to me.

Anyway, we have a draft working implementation of the folding
restore feature, so it can be used to experiment with different
storage variants. 

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Re: Restore previous folded state of org buffer
  2009-07-26 19:14             ` User
@ 2009-07-26 19:24               ` Bastien
  0 siblings, 0 replies; 14+ messages in thread
From: Bastien @ 2009-07-26 19:24 UTC (permalink / raw)
  To: User; +Cc: emacs-orgmode

User <spamfilteraccount@gmail.com> writes:

> Bastien <bastienguerry <at> googlemail.com> writes:
>> 
>> I was just about to suggest:  "Why not using a  VISIBILITY property
>> for that?" (that would spare us the additional file..) but you were
>> faster than me!  :)
>> 
>
> Ah, yes. Properties. Being a new user I haven't yet used them,
> so they didn't occur to me.
>
> Anyway, we have a draft working implementation of the folding
> restore feature, so it can be used to experiment with different
> storage variants. 

Sure!  That's great to have this, I think many people will use it.

-- 
 Bastien

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Re: Restore previous folded state of org buffer
  2009-07-26 17:22         ` User
  2009-07-26 18:50           ` Bastien
@ 2009-08-03  4:34           ` Carsten Dominik
  2009-08-03  5:33             ` User
  1 sibling, 1 reply; 14+ messages in thread
From: Carsten Dominik @ 2009-08-03  4:34 UTC (permalink / raw)
  To: User; +Cc: emacs-orgmode


On Jul 26, 2009, at 7:22 PM, User wrote:

> User <spamfilteraccount <at> gmail.com> writes:
>>
>> The folding information should simply be saved into a separate
>> file. For example, for notes.org the accompanying folding
>> information could be in notes.org.fold. The posted code can be
>> trivially modified to behave this way and with this change the
>> actual content of the org file is not affected at all and we have
>> a pretty usable folding save/restore extension for org.
>
>
> The thing pestered me, so I fixed it to take care of it.
>
> Now folding information is saved into a separate file and it is
> saved when the buffer is closed (but only if the buffer is saved
> to disk to avoid saving folding info for discarded buffers).
>
> I fixed the algorithm too, because it was buggy. Now it's working
> well and it's also simpler.
>
>
> http://www.emacswiki.org/emacs/orgfold-separate-file.el

Hi "User",

this is great functionality, thanks for sharing it.  I would like
to include it with Org-mode, s I need to ask:  Do you have a
copyright assignment with the FSF?  Or are you willing to sign one?

Thanks.

- Carsten

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Restore previous folded state of org buffer
  2009-08-03  4:34           ` Carsten Dominik
@ 2009-08-03  5:33             ` User
  2009-08-03  5:38               ` Carsten Dominik
  0 siblings, 1 reply; 14+ messages in thread
From: User @ 2009-08-03  5:33 UTC (permalink / raw)
  To: emacs-orgmode

Carsten Dominik <carsten.dominik <at> gmail.com> writes:
> 
> this is great functionality, thanks for sharing it.  I would like
> to include it with Org-mode, s I need to ask:  Do you have a
> copyright assignment with the FSF?  Or are you willing to sign one?

I don't have one and I doubt I'll have the time in these days to
deal with it.

The code is pretty trivial and short, so I think the best course
of action is that someone with proper legal status reimplements
it for org.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Re: Restore previous folded state of org buffer
  2009-08-03  5:33             ` User
@ 2009-08-03  5:38               ` Carsten Dominik
  0 siblings, 0 replies; 14+ messages in thread
From: Carsten Dominik @ 2009-08-03  5:38 UTC (permalink / raw)
  To: User; +Cc: emacs-orgmode


On Aug 3, 2009, at 7:33 AM, User wrote:

> Carsten Dominik <carsten.dominik <at> gmail.com> writes:
>>
>> this is great functionality, thanks for sharing it.  I would like
>> to include it with Org-mode, s I need to ask:  Do you have a
>> copyright assignment with the FSF?  Or are you willing to sign one?
>
> I don't have one and I doubt I'll have the time in these days to
> deal with it.

Getting one takes about 5 minutes now, and 5 minutes in a few weeks.

>
> The code is pretty trivial and short, so I think the best course
> of action is that someone with proper legal status reimplements
> it for org.

That is also a possibility, ok.

- Carsten

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2009-08-03  5:38 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-25 18:06 Restored previous folded state after buffer opened again? User
2009-07-25 18:57 ` Matthew Lundin
2009-07-25 19:14 ` Bastien
2009-07-25 19:34   ` Restore previous folded state of org buffer User
2009-07-25 22:28     ` Bastien
2009-07-26  7:04       ` User
2009-07-26 17:22         ` User
2009-07-26 18:50           ` Bastien
2009-07-26 19:14             ` User
2009-07-26 19:24               ` Bastien
2009-08-03  4:34           ` Carsten Dominik
2009-08-03  5:33             ` User
2009-08-03  5:38               ` Carsten Dominik
2009-07-26  0:05     ` Eric S Fraga

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).