devork

E pur si muove

Docstring folding

Saturday, February 16, 2008

In my last post I had a little rant about how python docstrings visually separate the function/method/class definition from the body. Mikko Ohtamaa raised a very good point though: the editor should fold it away.

Since my editor of choice is Emacs, said to be more an operating system then an editor, this must be possible. But surely someone more intelligent then me must have implemented this already (for I still don't know lisp, shame on me)! So I read the python-mode description which mentioned something about support for outline-minor-mode. This lead me to play around a little with outline-mode. I'ts rather nice and seems to do useful folding, once I get used to it.

But I'm not sure I can figure out how to fold away just the docstring in outline-mode! There seems to be a "Hide Entry" function that most of the time does just hide the docstring when the cursor is located over it. But sometimes it will hide a few more lines too... Surely I must be missing something, anyone some hints?

Saturday, February 16, 2008 | Labels: |

0 comments:

Post a Comment

Subscribe to: Post Comments (Atom)