vhdl-mode: Customizing Indentation
4 Customizing Indentation
*************************
The ‘vhdl-offsets-alist’ variable is where you customize all your
indentations. You simply need to decide what additional offset you want
to add for every syntactic symbol. You can use the command ‘C-c O’
(‘vhdl-set-offset’) as the way to set offsets, both interactively and
from your mode hook. Also, you can set up _styles_ of indentation.
Most likely, you’ll find one of the pre-defined styles will suit your
needs, but if not, this section will describe how to set up basic
editing configurations. Styles, for an explanation of how to
set up named styles.
As mentioned previously, the variable ‘vhdl-offsets-alist’ is an
association list between syntactic symbols and the offsets to be applied
for those symbols. In fact, these offset values can be an integer, a
function or variable name, or one of the following symbols: ‘+’, ‘-’,
‘++’, ‘--’, ‘*’, or ‘/’. The symbol values have the following meanings:
• ‘+’ – 1 x ‘vhdl-basic-offset’
• ‘-’ – -1 x ‘vhdl-basic-offset’
• ‘++’ – 2 x ‘vhdl-basic-offset’
• ‘--’ – -2 x ‘vhdl-basic-offset’
• ‘*’ – 0.5 x ‘vhdl-basic-offset’
• ‘/’ – -0.5 x ‘vhdl-basic-offset’
So, for example, because most of the default offsets are defined in
terms of ‘+’, ‘-’, and ‘0’, if you like the general indentation style,
but you use 2 spaces instead of 4 spaces per level, you can probably
achieve your style just by changing ‘vhdl-basic-offset’ like so (in your
‘.emacs’ file):
(setq vhdl-basic-offset 2)
To change indentation styles more radically, you will want to change
the value associated with the syntactic symbols in the
‘vhdl-offsets-alist’ variable. First, I’ll show you how to do that
interactively, then I’ll describe how to make changes to your ‘.emacs’
file so that your changes are more permanent.
Menu