-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[IMPROVEMENT] Toggle bullet on folded versus unfolded headline state - ▶ to ▼ #22
Comments
Hi @wakatara, that's a pretty nifty idea! I'll have to think about it, though I may not manage to do so properly before February. |
Well, I am using the right triangle now to demarcate the first two levels (as I did mess around with Notion over the holidays) and the toggle feature there is very nice (which is basically just org-mode folding and unfolding but with a nice vidual indicator. Also, while I'm thinking about it, this would also remove the need for the org-mode end of line ellipsis I currently use as well (which happens to be a down triangle... :-/ ). And I am sure I can hold my breath till February. Thanks for all your work on this library! Makes the UX in org-mode much much nicer. Makes a big difference. |
Actually, an even better think here would be to also allow the bullet to be optional or distinct if there was information in the fold. So, for example, have a simple hidden or missing bullet if it's simply a headline but then display a ▶ if there is actual content folded into the headline (and then, of course, the down arrow ▼ once unfolded... =] |
I finally have more time on my hands to look into this a little more. I looked a bit into the options and I'm afraid that the solution for this is the same that allows for example creating even more interactive elements in Org that can hide away information. It's a project I have put on hold for a while but wanna pick up again soon. The core technical issue to overcome with it is twofold: On the one hand, you can have text in an Emacs buffer hold such metadata (like "do I belong to a folded entry?") effortlessly, but keeping this metadata up to date requires a lot of moving parts in real time. Essentially each time the user executes a command and changes the buffer some bookkeeping will need to be done. This is the job of a mode that wants to achieve this. On the other hand, making Emacs visualize that metadata ("ah, this bullet belongs to a folded entry, hence I ought to display it as..") is also rather simple. This task is deferred to font-lock, which handles everything from syntax highlighting to Superstar making Org look nice. However, font-locking can be quite expensive, hence font-lock does not just constantly update the buffer but tries to only change bits it "has to". And that's the problem, really: Keeping these two independent processes in sync, and I'm working on an entire mode dedicated to nothing but keeping these two things in sync. I have not yet found a solution for this that can't be confused by simple operations, however (like cutting out large chunks of a buffer etc). My next plan towards this goal is to first write down and explain what I am doing over there and talk to the Emacs upstream to gain a deeper understanding of "real-time" font-lock. Sorry for the rant, but after discovering that this leads down the same rabbit hole as #20 I thought it was necessary to mention this at least somewhere. To get back to your initial request, there may be a way to do this specific thing with a nice hack involving orders of magnitude less complexity, so I'll see if I can come up with something over the weekend. If not, it is only an even bigger incentive to get the org-menu-mode engine to run without race conditions and other timing nonsense. |
Wow, that is much more complex than I thought it would be (so, out of curiosity, how does the org-mode ellipsis symbol know to appear on fold and unfold then?). Thank you for even considering it. I think your entire mode sounds very interesting and have to admit I selfishly want it since I'd also like better TeX rendering than org-mode currently support in-buffer. In any case, certainly interested to see what you come up with. I have to admit to only have messed around with font-lock over the Xmas holidays when I wanted to make my emacs experience a lot closer to something like Notion, so really interested in seeing the results. |
Yeah, sadly it's a bit hairy.
Org mode uses overlays for that, which are rather convenient, but as far as I'm aware can cause slowdown if used extensively. I usually restrict myself to using text properties exclusively, especially since my modes would easily double/triple the amount of overlays in the worst case. Anyway, I'll work on a more coherent update on the matter on the other repo, though I will likely first have to do some Font Lock research... |
This would definitely be a cool feature! (maybe something for upstream org even). BTW, @integral-dw, if you are not aware of @yantar92's work on reimplementing the org folding mechanism with text properties instead of overlays, you should take a look at that. May be some overlap or inspiration for org-superstar: https://github.com/yantar92/org |
Oh, that IS news to me! I'll have a look in the near future :) |
I have been using the org-fold branch for a few weeks and found that it speeds up my large org files. Hopefully it will be ready for merging soon. |
@andersjohansson |
Hola! Was just wondering if you ever got a chance to look into those overlays. (the interesting thing is most apps that use a web rendering (notion, workflowy, etc et) and lists now do the "▶" to "▼" swivel thing now. It is actually a suprisingly nice dynamic. Anyhow, was just wondering as I was back in org-mode again... =] |
What does org-fold do precisely? (and have you seem origami? I use that to help with folding in super-org-agenda. It is great.).
org-fold is a patch for Org mode. It changes _backend_ used to hide
text from using overlays to text properties.
origami is orthogonal to Org mode's folding. Org mode implements its own
folding mechanism in Org mode buffers specifically. origami is a generic
folding mechanism not specific to Org mode. Note that origami uses
overlays behind the scenes and hence will have problems on large
buffers.
|
Hi everyone, |
By the way, outline-mode got these kinds of toggles in Emacs 29. I haven’t looked into the implementation, and whether it can be used for org (which has recently split with outline-mode). But looks promising. |
I am currently using org-superstar (thank you) but am looking to make the UX on using it with org-mode a bit more like the toggles that you see in the popular program/web application Notion.
Basically, I want to have folded headlines bulleted with a "▶" and then when I tab to unfold the headline have the bullet change to be a "▼" ( a transition animation might be kinda nice, but hardly necessary. =] ).
If there is a way to do this already in superstar, and I just didn't figure it out, I apologize, but it seemed a nice effect to have as well as possibly being a cleaner mechanic than straight up bullets in some regard.
thanks!
Daryl.
The text was updated successfully, but these errors were encountered: