Grant Edwards <inva...@invalid> writes: > > On 2009-09-03, Ben Finney <ben+pyt...@benfinney.id.au> wrote: > > Tim Chase <python.l...@tim.thechases.com> writes: > > > > > > Any editor worth its salt will offer indentation-based folding (I know > > > vim does, and I would be astonished if emacs didn't. > > > > Emacs calls that ???hide/show???, and the ???hs-minor-mode??? can > > be enabled for any buffer (and can thus of course be automatically > > enabled on defined conditions, e.g. whenever a Python buffer is > > detected). > > > > Learn more at <URL:http://www.emacswiki.org/cgi-bin/wiki/HideShow>. > > There's only one problem: it doesn't work out-of-the-box. At > least it never has for me. The only thing it knows how to hide > is the entire body of a function definition. I never want to > do that. What I want to do is hide/unhide the blocks within > if/then/else or loops so that the control flow is clearer. > Emacs hs-minor-mode won't do that (at least not for me).
Hm. I wasn't aware of hs-minor-mode. But I've often used set-selective-display (C-x $), which hides all lines that are indented more than ARG columns (and un-hides them if you don't give an argument). But to fulfill the specific request of moving up to the top of a given block, there's also a `python-beginning-of-block' command in python-mode (bound to C-c C-u). If you set the mark (C-SPC) before you do python-beginning-of-block, then you can use `C-x C-x' or `C-u SPC' to jump back where you were. -- Don't be afraid to ask (Lf.((Lx.xx) (Lr.f(rr)))). -- http://mail.python.org/mailman/listinfo/python-list