Installing Gams-Mode for Emacs

After installing Emacs (see my previous post), the next thing to do is install gams-mode. If you got Emacs running, installing gams-mode is not so difficult.
First of all download gams-mode from Shiro Takeda’s website: You will find it here: gams-mode-download.
Update: you can now directly install gams-mode from the package repository:
  • Alt-x and type ‘list-packages’
  • search for gams-mode
  • click on it and install.

That’s all.

The files are zipped and should be unzipped to a directory Emacs will find. I show you my settings (as usual, you can do it in another way).
I have all my additional features in a directory that resides in the Emacs program directory:

The full name of the directory is C:\Programme\Emacs\site-lisp\gams. Notice that I don’t call the directory “..\gams-2.7.1” (the actual version). If there is a new version of gams-mode out, I just drop the files in this directory, and I do not have to adjust any settings I make in Emacs. You can see the other modes I use (for example python-mm, ess, planner, and auctex).

The next thing is to tell Emacs where it can find gams-mode. For this open your “.emacs” (dot-emacs) file that will be in your home directory (see my previous post). If there is no .emacs-file, you just create one.
Add the following text:
(setq load-path
(cons “c:/Programme/Emacs/site-lisp/gams/” ;; Set the installed directory!
load-path))
(require ‘gams)
The first 3 lines tell Emacs where to find gams-mode and the fourth line loads gams-mode.
Now you are ready to start using gams-mode. Open a gams-file in Emacs, and if all worked fine, you will see the gams-mode menu items (the red arrow in the next picture). In the picture, you can also see that I have some features installed that do not come with Emacs (blue arrow). I will talk about that in another post.
In the next post, I will tell you something about the great things that you can do with gams-mode and which will make your programming life more relaxed…

2 thoughts on “Installing Gams-Mode for Emacs

  1. Hi Ben
    Sorry to hear that. First I would check if gams-mode can be activated by giving the command Alt-X and type gams-mode.
    If this doesn’t start the gams-mode, Emacs doesn’t find gams-mode. If yes, you should just activate in your .emacs file with (require ‘gams-mode).
    Otherwise, you can now install gams-mode from the melpa-directory: Alt-X list-packages and search for gams-mode. This should probably work.
    Let me know if this isn’t working.
    Cheers
    Renger

  2. Hi,

    I’m following all the steps in your blog to the letter, but although I have emacs running I cannot make emacs open GAMS-mode when I open a .gms file.

    Do you have any typical troubleshooting tips I might be falling foul of?

    I should add, I’m running this on a work computer for which I only have user permissions.

    Cheers,

    Ben

Comments are closed.