Currently, I use the hs-minor-mode to collapse my python code and make it easier to work with - however, by default this only folds def my_function(): blocks. Is it possible to get it to work with if, for, while etc. blocks as well?

If not, does anyone know a better option for code folding? I do use C-s and M-x occur to move around my code already, I just sometimes like to fold my code so I don't have so much to look at.


After a little more looking around, I found:

Which can do what I wanted (and possibly a little more). I haven't thoroughly tested them both out, but on first impression, yafolding is working the best so far on python.el.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.