4.1.2 Continued Statement Indentation

Continuation lines (following a line ending with $) can receive a fixed indentation offset from the main level, but in several situations IDLWAVE can use a special form of indentation which aligns continued statements more naturally. Special indentation is calculated for continued routine definition statements and calls, enclosing parentheses (like function calls, structure/class definitions, explicit structures or lists, etc.), and continued assignments. An attempt is made to line up with the first non-whitespace character after the relevant opening punctuation mark (,,(,{,[,=). For lines without any non-comment characters on the line with the opening punctuation, the continued line(s) are aligned just past the punctuation. An example:

function foo, a, b,  $
              c, d
  bar =  sin( a + b + $
              c + d)

The only drawback to this special continued statement indentation is that it consumes more space, e.g., for long function names or left hand sides of an assignment:

function thisfunctionnameisverylongsoitwillleavelittleroom, a, b, $
                                                            c, d

You can instruct IDLWAVE when to avoid using this special continuation indentation by setting the variable idlwave-max-extra-continuation-indent, which specifies the maximum additional indentation beyond the basic indent to be tolerated, otherwise defaulting to a fixed-offset from the enclosing indent (the size of which offset is set in idlwave-continuation-indent). As a special case, continuations of routine calls without any arguments or keywords will not align the continued line, under the assumption that you continued because you needed the space.

Also, since the indentation level can be somewhat dynamic in continued statements with special continuation indentation, especially if idlwave-max-extra-continuation-indent is small, the key C-u TAB will re-indent all lines in the current statement. Note that idlwave-indent-to-open-paren, if non-nil, overrides the idlwave-max-extra-continuation-indent limit, for parentheses only, forcing them always to line up.

User Option: idlwave-continuation-indent (2)

Extra indentation applied to normal continuation lines.

User Option: idlwave-max-extra-continuation-indent (20)

The maximum additional indentation (over the basic continuation-indent) that will be permitted for special continues. To effectively disable special continuation indentation, set to 0. To enable it constantly, set to a large number (like 100). Note that the indentation in a long continued statement never decreases from line to line, outside of nested parentheses statements.

User Option: idlwave-indent-to-open-paren (t)

Non-nil means indent continuation lines to innermost open parenthesis, regardless of whether the idlwave-max-extra-continuation-indent limit is satisfied.