alfiedotwtf4 · 2022-11-03 03:21
Has anyone successfully gotten rust-mode and outline-minor-mode working together? I would like to have folding on functions and blocks in emacs like I did in Vim, but can't work it out :(
L-Szos · 2022-11-03 08:41
This doesnt answer your question directly, but its not terribly difficult to implement region folding by using overlays. If youre comfortable writing elisp or want to try getting comfortable, you can try implementing it. Once you have the region folding implemented, you can define commands to highlight the current thing (block, function, etc) and call the region folding function.
If you dont want to implement region folding yourself, check out hideshow minor mode [1]. It should work fine for delimited code blocks.
1 https://www.gnu.org/software/emacs/manual/html_node/emacs/Hideshow.html
alfiedotwtf4 · 2022-11-03 13:23
I'm slowly going through the elisp manual, but hideshow looks doable for now. Thanks!
AblatedSprocket · 2022-11-03 13:36
Are you avoiding hide-show minor mode for code folding?
L-Szos · 2022-11-03 14:04
You may want to bind some different keys for hs mode, i found them very clunky.
Ancient-Nectarine-81 · 2022-11-03 20:15
In evil mode using rustic folding, works out of the box, with the evil bindings.
alfiedotwtf4 · 2022-11-03 22:03
Oh. Thanks. Haven't yet tried Evil yet, but yeah I always loved Vim's folding
alfiedotwtf4 · 2022-11-03 22:04
Not avoiding, more of didn't know it existed. Outline-mode and Outline-minor-mode is what came up with my first search. Seems that There's More Than One Way To Do It :)
a-hausmann · 2022-11-04 03:59
Have you looked at [Origami](https://github.com/gregsexton/origami.el)?
alfiedotwtf4 · 2022-11-04 08:21
Thanks for that. Multiple people have suggested Hideshow, which seems to do what I want. If I bump up against anything, I'll take a look at Origami.
JohnDoe365 · 2022-11-04 08:32
Yeah, my gripe too. From a user perspective it's just folding in vim parlance. But in your case the way to go is `hs-minor-mode`