Code folder with Emacs

Grant Edwards grante at visi.com
Fri Mar 21 10:16:08 EDT 2008


On 2008-03-21, Diez B. Roggisch <deets at nospam.web.de> wrote:

>> Has anybody figured out how to do code folding of Python source
>> files in emacs?  
>> 
>> I tried "hide-show" minor mode, but it doesn't really work for
>> Python code: the only think it knows how to hide/show are
>> function bodies.  It can't do normal things like hide/show a
>> code block like it can for other languages.
>
> I just recently started hacking in emacs, to enhance the
> python-mode and make pdb work with persisten breakpoints (by
> that I mean BPs that survive one debug-session).
>
> Code-folding isn't currently on my agenda, but an interesting
> idea.  given that e.g. ecb already has structural analysis
> buffers, there are python-aware code parsers (cedet?)

Given the simplicity of python's indentation-defined
block-delimiting, It's hard to understand how hide-show managed
to come up with a "block" definition that works for function
bodies but not for other identically delimited blocks.

> So it shouldn't be too hard. The only interesting/important
> thing would be to integrate it with ecb because I wouldn't
> want several parse-runs at once.

When I have some time, I'm going to take alook at hide-show's
Python support, but my lisp skills are a bit rusty...

-- 
Grant



More information about the Python-list mailing list