In emacs matlab-mode, highlight a region then use indent-region:
C-M-\ runs the command indent-region which is an interactive compiled Lisp function in `indent'. (indent-region START END COLUMN)
Indent each nonblank line in the region. With prefix no argument, indent each line using `indent-according-to-mode', or use `indent-region-function' to do the whole region if that's non-nil. If there is a fill prefix, make each line start with the fill prefix. With argument COLUMN, indent each line to that column.
When you call this from a program, START and END specify the region to indent, and COLUMN specifies the indentation column. If COLUMN is nil, then indent each line according to the mode.
porterboy wrote:
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?
Thanks The Porterboy - "Lovely day for a Guinness"
-- http://mail.python.org/mailman/listinfo/python-list