Tuesday 15 June 2010
-
Filed under
Emacs + GAMS + Gams-Mode
First of all download gams-mode from Shiro Takeda’s website: You will find it here:
gams-mode-download.
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 an other 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…
::
Share or discuss
::
2010-06-15 ::
admin
Tuesday 15 June 2010
-
Filed under
Emacs + GAMS + Gams-Mode
http://aquamacs.org/.
On Windows it is a different story. Emacs is coming from the Unix world and on Windows installing asks for a little bit more knowledge of Windows basics. You can’t for example install an additional feature (like Gams-mode for Emacs) by just double-clicking on a file. You have to move the downloaded files to a certain directory and add some lines of code to the file with the start-up settings of Emacs. This start-up file with the for Windows-users funny name of “.emacs” (dot emacs) resides in the home directory, which is on Unix a kind of “Documents and Settings”-directory. The good thing is that everything is well documented either in the readme-files that come along with the packages or some Windows user wrote a blog on it or answered a question in a forum.
Emacs comes in lots of flavors. You can download the standard version from one of the mirrors at http://www.gnu.org/prep/ftp.html and install it . This is the “hard way”: you have to add features like AucTex or ESS that are not part of the standard Emacs distribution yourself. Another way is to download a version that has already some additional features like LaTeX or ESS prepackaged. Finallly, there is a version that is geared specially to Windows (take a look at http://ourcomments.org/Emacs/EmacsW32.html) . Until now there is no version that already has Gams-mode in it.
Let us have a look at the three different ways of setting up your Emacs (only the first step is different)
- Choose your version:
- Download the windows installer packages from the Emacs homepage and just double click on it.
- Download the version geared to Windows
- Download a version with some features (in Emacs these are called modes) already prepackaged. A real good one is maintained by Vincent Goulet (http://vgoulet.act.ulaval.ca/en/ressources/emacs/windows). It already contains LaTeX, ESS (Emacs Speaks Statistics for R/S or Stata), windows-printing and some more features. You will find also a good instruction on how to set up Emacs.
- Double click on the downloaded file and install Emacs.
- Emacs wants to have a home directory and we have to tell it where it is.
- First decide where your home directory will be and create it (this can be anywhere on your computer. I have it in my Emacs directory: (c:\program files\emacs\home)
- Define a user variable called home with the full path name of your newly created home directory:

- Go to your system settings – click on the system icon”- click on “advanced settings”. Choose “environmental variables”
- Define a new user variable and call it “HOME”

That’s all! You probably will have a window icon on your desktop and you can start Emacs (if you haven’t an icon go to the “bin” directory where Emacs resides and double click on the file runemacs.exe).
There is a nice introduction to Emacs to be found at http://old.pubhealth.ku.dk/bsa/software/applications/index.html.
Have fun with Emacs!
::
Share or discuss
::
2010-06-15 ::
admin
Tuesday 15 June 2010
-
Filed under
Emacs + GAMS + Gams-Mode
GAMS users probably spend most of their time editing their models. Just before project deadlines they may sit more than 8 hours a day in front of their computer hacking through their code. The choice of a good editor can therefore be crucial. After years of trying different editors I finally stuck (xxx) with the open-source editor Emacs.
For those of you who want to stop reading because they heard about the disadvantages of Emacs (“It has a steep learning curve”, “It is more a program for hackers” or “You have to learn all kind of key bindings by heart”), I can only say, that most of the disadvantages of Emacs are true. But: using Emacs in combination with
Gams-Mode (an extension of Emacs developed by Shiro Takeda) can make your programming life so much easier and you will increase your efficiency so much, that reading on might save you hours of editing time.
For those of you who need more reasons for switching to Emacs, here are some of the advantages (in upcoming posts I will talk about all of these advantages in more detail):
- The editing facilities of the GAMS IDE are nothing compared to Emacs.
- The Gams Mode in Emacs is heaven on earth for doing Gams coding
- If you write your reports with LaTeX Emacs is probably one of the best editors around .
- For those of you who work with R (statistics) or Stata: Emacs Speaks Statistics (ESS) lets you do your statistics from within Emacs.
- If you write your statistics reports with LaTeX, you can use Sweave allowing you to embed your R-Code in your LaTeX document and let Emacs generate reports while running your analysis, generating graphs and tables for your report at the same time.
- Emacs has many extensions for working with other programming languages (Python, Perl, PHP, etc.).
- Emacs allows you to integrate your versioning system. I use Subversion and can from within Emacs use all commands like commit, update, etc.
- Making quick notes is easy in Emacs: you can generate a note and Emacs adds automatically a hyperlink to the file you are working on. This is a great feature if you want to keep working on the main issues in your model, but don’t want to forget to do some minor tasks. Instead of writing those tasks on a peace of paper of making it a task in Outlook, you can keep on working in Emacs and the next day it is easy to jump back to the place where the task refers to.
- Emacs runs on Windows, Linux and Mac.
For me the most important reason was the possibility to use one and only one editor for completely different tasks (R, Gams, LaTex, Note taking, Pytyhon and PHP). Instead of having to learn several different editors like WinEdt, the editor of GAMS IDE, Tinn-R, Beans, OneNote, I now have one editor.
2 comments ::
Share or discuss
::
2010-06-15 ::
admin