Emacs and Indentation

Skip Montanaro skip at pobox.com
Wed Nov 6 12:10:38 EST 2002


    Michael>     for x in mylist:
    Michael>     if not x in filled:
    Michael>         foo[x] = x[1]
    Michael>         bar[x] = x[2]
    Michael>     y = x

    Michael> In other languages (Tcl, Java, C++) where the block delimiters
    Michael> are explicit, I can just highlight the region and issue an
    Michael> "indent-region" and it would automatically indent everything
    Michael> appropriately.  As far as I can tell, this does nothing in
    Michael> Emacs (v21.4, windows).  

If you are using python-mode to edit Python source, it adds C-c > and C-c <
to move the highlighted region in the obvious direction.  python-mode.el is
available in the Misc subdirectory of the source distribution.  I assume
it's also delivered with Windows binaries, but if not, you can grab the most
recent version from CVS using this URL:

    http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/*checkout*/python/python/dist/src/Misc/python-mode.el?rev=HEAD&content-type=text/plain

-- 
Skip Montanaro - skip at pobox.com
http://www.mojam.com/
http://www.musi-cal.com/




More information about the Python-list mailing list