orgzly / orgzly-android

Outliner for taking notes and managing to-do lists
https://www.orgzly.com
GNU General Public License v3.0
2.7k stars 305 forks source link

Attempt to restore folding state after sync #286

Open edgimar opened 6 years ago

edgimar commented 6 years ago

Currently after an org-file has changed in a "sync repository", and orgzly loads this changed file, then all folding information is lost, and the file appears with no folding in orgzly.

It would be great if orgzly would keep a list of which headlines are folded, and then after loading the changed org-file, fold any headlines found in the last-known list of folded headlines.

nevenz commented 6 years ago

This could be tricky (though very useful). Trick is to recognize the old notes, when notebook is loaded. I see two options:

Both require more properties, but at least :ID: is standard - I'd like to avoid adding new properties as mush as possible.

BTW, there's :VISIBILITY: property for initial state which could also be supported. It's related, but I don't think it helps for this issue. Folding state could be kept in it, but I don't think we want to overwrite it.

edgimar commented 6 years ago

It would make sense to me to not tie the folded state in Orgzly with the text-content of the org-file. A particular "folding configuration" is just a view of a full org-file, and when using org-mode in emacs, it is possible to use indirect buffers to have completely different views of the same file (where one buffer has headlines folded that the other doesn't). Orgzly is also (in my opinion), just a "view" of the text-file, and the state of that view should be associated w/ the view (i.e. with Orgzly metadata not directly stored in the org-file).

vit1-irk commented 6 years ago

I have large org-file with lots of nested lists. There is a button in the top panel like "fold-unfold all". It would be great to have an option in the settings to show your notebook folded by default.

Now it is "show unfolded by default" when sync is turned on. And it is really annoying sometimes

Ekleog commented 5 years ago

@vit1-irk I think this is another issue, potentially easier to solve than this one but nowhere near as useful (at least I know my issue is that I open specific sections/subsections ; if I want to fold all it's one click, but to actually get back the previous folding state it's a lot of clicks to re-open the correct ones).

@edgimar I think storing the ID as seen by orgzly in :ID: would make it possible to more easily store which headline is folded in Orgzly's view without storing whether the headline is folded or not.

That being said, I think I'd also rather have a heuristic where only the headline text and its parents' text is considered, because I would rather not pollute every headline with a :ID: property.

Anyway, I just dropped by to say this would be great :)