awth13 / org-appear

Toggle visibility of hidden Org mode element parts upon entering and leaving an element
MIT License
364 stars 19 forks source link

Support for property drawers #27

Closed archiif closed 2 years ago

archiif commented 3 years ago

Any possibilities of supporting toggling property drawers? Hiding the visibility of property drawers is not an official feature of org-mode unlike other elements currently supported, but it's definitely useful for certain workflows like org-roam.

Though, one thing I'm not sure about is when the visibility should be toggled:

Some recent prior art to property toggling: https://github.com/org-roam/org-roam/wiki/Hitchhiker's-Rough-Guide-to-Org-roam-V2#hiding-properties

awth13 commented 3 years ago

Hey, @archiif! Thank you for the suggestion!

I just quickly tested it and it is absolutely possible. The way org-appear works, it will only make sense to toggle visibility when the cursor is over the heading since anything within the drawer is not counted as a drawer by the org-element API.

One problem I can see with adding this feature is that org-appear only "unhides" elements that are already hidden. I'm not sure if we would want drawers to be hidden immediately when starting org-appear or only when the cursor has passed through them once. I prefer the latter since it defers the necessary computation and doesn't require as many changes to the core of org-appear. I realise, however, that it may be inconvenient for heavy drawer users (which I am not). Do you have any suggestions?

archiif commented 3 years ago

Perhaps provide a function that lets users hide property drawers, but don't do anything with it and let the user decide when it should be run (e.g. through hooks, etc.).

But it's true that hiding functions may seem out of place for this project. Maybe a more ideal & general solution is to let users supply their own custom conditions that would determine when & how org-appear hides/unhides elements. This way, users are free to customize their own hiding functions according to their preferences. But it seems a bit complicated and I'm not sure how it would look like at all.

awth13 commented 2 years ago

Hey, @archiif! I'm sorry it took me so long to respond.

While I was away, I upgraded to Org-roam V2 and did some experiments with property drawer hiding. In the process, I realised that, while this functionality is close to the org-appear main idea, it is not what org-appear is supposed to do (interactive toggling). Besides, I believe that the snippet you shared from the Hitchhiker's Rough Guide to Org roam V2 should be sufficient for the absolute majority of users that simply don't want to see the property drawer at the top of their notes.

I am closing this issue as a result. If you think I am wrong in any way in this decision, please reopen the issue and let me know!