automatic nesting and indentation in emacs

Thomas Heller theller at python.net
Fri Feb 25 05:43:52 EST 2005


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



More information about the Python-list mailing list