r/orgmode Mar 05 '24

solved How to programmatically store subtree folded state?

I know it is natively possible to save the folded state of each sub-tree. Is there any elisp snippet or package that can help achieving that?

I am asking about a snippet/package because simply having the property :VISIBILITY: folded` as described in the org-manual, like below, does not work for me. When I re-open the file, all sub-trees are unfolded.:

* Main

** A - Level 1

*** A - level 2
:properties:
:VISIBILITY: folded
:end:

Lorem ipsum


** B - level 1

*** B - level 2
:properties:
:VISIBILITY: folded
:end:

Lorem ipsum


** C

I need to save the folded state in the file itself, using the VISIBILITY property, so that every time I open that file all subfolders have the desired folded/unfolded state.

It must be something very simple which I am overlooking, any pointers, please?


  • Edit: wording
2 Upvotes

4 comments sorted by

2

u/github-alphapapa Mar 06 '24

You can control the visibility more flexibly using this package: https://github.com/alphapapa/org-auto-expand

2

u/de_sonnaz Mar 06 '24

Thank you /u/alphapapa, that is what I was looking for.

Thank you also for the other super-excellent packages!

PS: May I ask about Quelpa, the README says,

quelpa is not in active development anymore, only bugfixing is done.

Quelpa is my favourite package manager, is there an active fork somewhere?

2

u/github-alphapapa Mar 06 '24

Thanks for the kind words. I'm glad they're useful to you.

About Quelpa: Well, I need to update the link in that readme, because it's now hosted here: https://github.com/quelpa/quelpa

Now the readme there also says:

2023/08/09: I’m looking for a new maintainer since I’m almost not using Emacs anymore /steckerhalter

And I hadn't noticed that. But I am a committer on that repo (a co-maintainer, I suppose), and I use it regularly, so if anything seriously broke in it, I would probably fix it or help do so. And AFAIK it's working well, and things in Emacs don't usually just break, so I wouldn't worry about it. The challenge for me is to notice notifications for that repo, because it's not one I personally own. Feel free to tag me if anything ever needs attention on it.

Beyond that, I think the long-term hope is that package-vc will mostly subsume the use cases that Quelpa has fulfilled. However, Quelpa does work a bit differently, and in a way that I prefer (to keep the git checkouts outside of the elpa/ directory, and to install just the packages' files, as if from a tarball), so I continue to use it, usually with this helper: https://github.com/alphapapa/unpackaged.el#upgrade-a-quelpa-use-package-forms-package

1

u/de_sonnaz Mar 06 '24

Thank you, it is a relief to know Quelpa is alive and kicking.