Using the identifier-list in Gams-mode

Gams-mode has lots of features and I am still amazed how powerful it is. I just discovered the use of the identifier-list (C-c C-a). I have a rather complex model with lots of include files and easily forget all the parameter names I use. Was it scale_mrd or mrd_scale? What was the name of the set HH or HHG? Here is where the identifier list comes in handy. Just hit C-c C-a and all the parameters, sets, variables appear as a new buffer.
 
 
 
 
You can change the way this information is listed. For example hit in this buffer “j” and all the information is grouped. You can hit the “+” or “-” sign to show or hide a certain group. Now you can work in your gams file and scroll or search through the identifier list. It is also helpful if you have forgotten to write the text describing an identifier: just scroll through the list and use “space” to jump to the identifier in you gams file and add the description. If you hit “enter” you jump to the identifier and the identifier-list buffer is closed.
 

Adding Gams file extensions in gams-mode

In Gams-Mode all files with the extension “gms” are recognized as gams-files and all keywords are highlighted properly. You can add other extensions that should be recognized by setting the variable gams-file-extension.
An easy way to find this in Emacs is by going to “Options” – “Customize Emacs”  Settings matching regexp” where you search for gams-file-extension (it is in the group “gams”).
 
Just click INS and add your extension (I added inc as extension).
 
Do not forget to save your settings.

Template Mode for Emacs

If you write a lot of R-, Stata-, Gams and/or LaTeX-files templates can make your life more relaxed. Emacs doesn’t have a template system (well there is auto-insert, but I did not find enough information on how to use if for templates). I used to have some templates in a directory and usually I would start with them (and forget that I should save it under another name…). The disadvantage is that you have to jump around in the file to fill out the information you want to have at the top of the file (like project name, topic, file name etc.). Today I discovered templatemode (see http://emacs-template.sourceforge.net/details.html). It works like a breeze and makes my writing life much easier.
 
I have templates for the above mentioned file types. The Gams template looks like this:
 
Now if I start a new file, TemplateMode asks me if I want to use the Gams-template, it inserts all the information between >>> and <<< or asks for information to insert. For example DIR, DATE will grab the directory and the date. At the end of the template file you see pairs of words. These words define the interactive part. Templatemode asks me for the project name with Project:, the job with Job: and the Gams title with Title:.
 
The line with the Version Control Information grabs information from my verison control system as soon as I commit the file (and is not part of templatemode).
 
This is how a new Gams file would look like:
 
 
Installation is easy and you can find lots of examples in the directory.