GNU Info

Info Node: (ada-mode)Automatic Smart Indentation

(ada-mode)Automatic Smart Indentation


Next: Formatting Parameter Lists Prev: File Browser Up: Top
Enter node , (file) or (file)node

Automatic Smart Indentation
***************************

   Ada mode  comes with a full set of  rules for automatic indentation.
You can of course configure the  indentation as you want, by setting the
value of a few variables.

   As  always,  the  preferred  way  to  modify variables  is  to  use
the `Ada->Customize' menu  (don't forget  to save your  changes!). This
will also show you some example of code where this variable is used, and
hopefully make things clearer.

   The relevant variables are the following:

`ada-broken-indent'           (default value: 2)
     Number of columns to indent the continuation of a broken line.

`ada-indent'                  (default value: 3)
     Width of the default indentation.

`ada-indent-record-rel-type'  (default value: 3)
     Indentation for `record' relative to `type' or `use'.

`ada-indent-return'           (default value: 0)
     Indentation for `return' relative to `function' (if
     `ada-indent-return' is greater than 0), or the open parenthesis
     (if `ada-indent-return' is negative or null).  Note that in the
     second case, when there is no open parenthesis, the indentation is
     done relative to `function' with the value of `ada-broken-indent'.

`ada-label-indent'            (default value: -4)
     Number of columns to indent a label.

`ada-stmt-end-indent'         (default value: 0)
     Number of columns to indent a statement `end' keyword on a
     separate line.

`ada-when-indent'             (default value: 3)
     Indentation for `when' relative to `exception' or `case'.

`ada-indent-is-separate'      (default value: t)
     Non-`nil' means indent `is separate' or `is abstract' if on a
     single line.

`ada-indent-to-open-paren'    (default value: t)
     Non-`nil' means indent according to the innermost open parenthesis.

`ada-indent-after-return'     (default  value: t)
     Non-`nil'  means that  the current  line will  also be
     re-indented before inserting a newline, when you press <RET>.

   Most of the  time, the indentation will be automatic,  i.e when you
will press <RET>,  the cursor will move  to the correct  column on the
next line.

   However, you might want or  need sometimes to re-indent the current
line or a set of  lines. For this, you can simply go  to that line, or
select the lines,  and then press <TAB>. This  will automatically
re-indent the lines.

   Another mode of indentation exists that helps you to set up your
indentation scheme. If you press `C-c <TAB>', Ada mode will do the
following:

   * Reindent the current line, as <TAB> would do.

   * Temporarily move the cursor to a reference line, i.e., the line
     that was used to calculate the current indentation.

   * Display at the bottom of the window the name of the variable that
     provided the offset for the indentation.

   The exact indentation of the current line is the same as the one for
the reference line, plus an offset given by the variable.

   Once you know the name of the variable, you can either modify it
through the usual `Ada->Customize' menu, or by typing `M-x
customize-variable <RET>' in the Emacs window, and then give the name
of the variable.

`<TAB>'
     Indent the current line or the current region.

`M-C-\'
     Indent lines in the current selected block.

`C-c <TAB>'
     Indent the current line and prints the name of the variable used
     for indentation.


automatically generated by info2www version 1.2.2.9