Indenting with Gams-mode
The new version of Gams-mode has a nice feature that helps you in formatting your model.
You can automatically indent GAMS programs according to GAMS syntax.
M-C-\ = Indent region. Specify region and type M-C-\.
TAB = Indent the current line.
On the left you see the model before using the indent feature of Gams-mode. I selected the region and typed M-C-\ (`indent-region’).
You can see on the right side what happened. The set and parameter declarations are nicely formatted and the loop is clearly visible because all assignments in the loop are indented.
This example was taken from the file gams-sample.gms which resides in the gams-mode directory (and contains lots of useful tricks with Gams-mode).
Another nice feature is indenting a region (examples taken from the sample-text.gms file from Gams-mode.
Just mark the region you wan to indent and hit c-c c-y. Choose “t” if it is a table and “o” for other text.
Here an example (once again taken from the sample file):
or a table