automatic nesting and indentation in emacs

Chris Smith smitty_one_each at bigfoot.com
Fri Feb 25 07:50:33 EST 2005


>>>>> Thomas Heller <theller at python.net> writes:

    > porterboy76 at yahoo.com (porterboy) writes:
    >> CONTEXT: I am using Emacs to edit Python code and sometimes
    >> also Matlab code.  When I hit <return> in a loop of some sort,
    >> Emacs usually gets the nesting indentation right, which is
    >> particularly important in Python.  To ensure this I have used
    >> python-mode.el and matlab.el modes in emacs.
    >> 
    >> QUESTION: If I suddenly decide I want an outer loop, do I have
    >> to manually readjust the indentation of all the inner loops? Or
    >> can emacs do it automatically? I know the Matlab in-built
    >> editor has a tool called "smart-indent" which will
    >> automatically align highlighted text to have the correct
    >> indentation. Does Emacs have something similar?

    > Mark the lines to be readjusted, then hit 'C-c >' or 'C-c <'.
    > Or hit 'C-h m' to get an overview for Python mode.

    > Thomas
I've liked the XEmacs python mode, as it is doesn't trigger the nasty
readline dependency.  Possibly fixed.
At any rate, with a region selected, "C-c >" and "C-c <" do the
obvious.
Two other killer features of the One True Editor are rectangles,
e.g. "C-x r o" with a highlighted region, align-regexp, and registers.
Three!  Three killer features of TOTE are rectangles, align-regexp,
registers, and PyMacs.
Oh! I'll just give up on the feeble Spanish Inquisition reference and
send you to http://www.emacswiki.org , where these and other righteous
goodies will, indeed, sanctify you within the bosom of the only editor
that has its own house of worship.
Best,
Chris



More information about the Python-list mailing list