Chapters:
1: Introduction
2: Simple example
3: Invocation
4: Finer Control
5: X-Y Plots
6: Contour Plots
7: Image Plots
8: Examples
9: Gri Commands
10: Programming
11: Environment
12: Emacs Mode
13: History
14: Installation
15: Gri Bugs
16: Test Suite
17: Gri in Press
18: Acknowledgments
19: License
Indices:
Concepts
Commands
Variables

## 12.3: Installing gri-mode.el, the nuts and bolts.

The Emacs ``gri-mode.el`' file is now bundled with gri, so odds are you already have it. If not, you will find it at gri's web site http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/gri/gri/gri-mode.el

The following installation steps appear a bit complicated. That's only because gri has changed how it gets installed a few times, and gri-mode.el works with all of these various methods. If you use gri from a Linux package (Debian or Red Hat) or if you compiled it yourself using the default configuration, you won't need to do much.

To install ``gri-mode.el`', follow these 4 steps. If gri-mode is already installed, you can skip the first two steps and move on to the last two, in which you tell Emacs that you'd like to use Gri mode when you edit files that end in ``.gri`', the Gri suffix. (Actually, if you're using Debian linux, you can skip all of these steps since the system will assume that you want gri-mode if you're editing a Gri file.)

- Step 1: Placing gri-mode.el where Emacs can find it.
- Step 2: Configuring gri-mode to where gri lives on your system.
- Step 3: Telling emacs to load gri-mode
- Step 4: Extra user configuration of gri-mode.

### 12.3.1: Placing gri-mode.el where Emacs can find it.

(Those using gri from gri's RPM package, a Debian package or a Red Hat package users can skip this, as it is done for them)

Extra ``.el`' files like ``gri-mode.el`' that are not part of Emacs should be stored in a directory where Emacs will find them when you ask it to load them. The files should therefore be found in Emacs' load-path. To see the directory list currently in the load-path, do this in Emacs:

    C-h v load-path

If you have access to system directories, put gri-mode.el in a site-lisp directory, such as ``/usr/local/share/emacs/site-lisp/`' That way all users will have access to the files.

If you don't have access to a site-lisp directory (e.g. you have only a user account), then create a directory where your extra ``.el`' files will be stored and add it to Emacs' load-path. For example, say you created the directory ``~/emacs`' and stored gri-mode.el there, you would then put this near the top of your ``~/.emacs`' file:

    (setq load-path (cons "~/emacs" load-path))

### 12.3.2: Telling gri-mode where gri resides

(Those using gri from gri's RPM package, a Debian package or a Red Hat package users can skip this, as it is done for them)

You may skip this section if gri is installed on your system as ``/usr/local/bin/gri-2.12.15`' and ``/usr/local/share/gri/2.12.15/gri.cmd`' (the default when compiling gri yourself). If not, then you may need to set the Emacs variable ``gri*directory-tree`' in a startup file such as in your ``~/.emacs`' file.

The Emacs variable ``gri*directory-tree`' is used to configure gri-mode to tell it where Gri is installed on your system. For the default gri installation paths used in this gri release, gri-mode expects to find the gri executable and the file gri.cmd as: ``gri*directory-tree/2.12.15/gri.cmd`' and ``/usr/local/bin/gri-`'2.12.15 where ``gri*directory-tree`' is by default set to ``/usr/local/share/gri/`'.

If you have only one version of gri installed on your system, gri-mode will also look to find ``gri.cmd`' and the gri executable like so:

1. Gri executable in the PATH, with startup file ``gri*directory-tree/gri.cmd`'.
2. Gri executable in the PATH, with startup file ``gri*directory-tree/lib/gri.cmd`'.
3. Gri executable ``gri*directory-tree/bin/gri`', with startup file ``gri*directory-tree/lib/gri.cmd`'.

However, gri-mode was designed to support, and ease the use of, multiple installed versions of gri. To use this feature, you must use the gri version number as a directory name under the ``gri*directory-tree`' path, like this:

    gri*directory-tree/VERSION/bin/gri
    gri*directory-tree/VERSION/lib/gri.cmd

(e.g. ``/opt/gri/2.040/bin/gri`' and ``/opt/gri/2.040/lib/gri.cmd`' with ``gri*directory-tree`' set to ``"/opt/gri"`')

or without the lib and bin subdirectories if the executable is found in the PATH named like ``gri-VERSION`' (This is the way Debian packages are set up): the file ``gri*directory-tree/VERSION/gri.cmd`' and the ``gri-VERSION`' executable in the PATH (e.g. ``/usr/share/gri/2.1.17/gri.cmd`' and ``/usr/bin/gri-2.1.17`' with ``gri*directory-tree`' set to ``"/usr/share/gri"`')

Important note: You may have more than one tree and make a list of them:

    (setq gri*directory-tree '("/opt/gri/" "/usr/share/gri/"))

Examples:

1. If you use a RedHat package installed like:

       /usr/bin/gri
       /usr/share/gri/gri.cmd

   then you'd also use:

       (setq gri*directory-tree "/usr/share/gri/")

   but gri-mode would know of only one installed version of gri.

2. If you use a Debian GNU/Linux installation like:

       /usr/bin/gri -> /usr/bin/gri-2.1.17
       /usr/share/gri/2.1.17/gri.cmd

   then you'd use:

       (setq gri*directory-tree "/usr/share/gri/")

   Note that all gri binaries must exist in the path with version number suffixes (e.g. ``gri-2.1.17`') since there is no ``/usr/share/gri/2.1.17/bin/`' directory (using a similar structure to ``opt/gri`' below) where gri-mode can find the binary corresponding to a given version number.

3. If you had multiple versions of Gri installed like so (this reflects the installation paths used in older gri releases):

       /opt/gri/2.040/bin/gri
       /opt/gri/2.040/lib/gri.cmd
       /opt/gri/2.041/bin/gri
       /opt/gri/2.041/lib/gri.cmd

   then you'd use:

       (setq gri*directory-tree "/opt/gri/")

### 12.3.3: Telling emacs to load gri-mode

(Those using a Debian package can skip this, as it is done for them)

To tell emacs to use this mode with ``.gri`' files, you can load gri-mode whenever a new emacs session is starting by adding the following line to your ``~/.emacs`' file:

    (require 'gri-mode)

This is a good method when you only start emacs once a week and use it for every file you edit (as you should).

If you startup a fresh emacs every time you edit then you probably only want to load gri-mode into emacs when you need it. In that case, instead of the ``require`' statement above, add the following lines to your ``~/.emacs`' file:

    (autoload 'gri-mode "gri-mode" "Enter Gri-mode." t)
    (setq auto-mode-alist (cons '("\\.gri$" . gri-mode) auto-mode-alist))

The first line tells Emacs that it will find out what it needs to know about running the command ``M-x gri-mode`' by loading the file ``gri-mode.el`'. The second line tells it to run the command ``M-x gri-mode`' when a file with extension ``.gri`' is visited (thus using gri-mode with all those files).

### 12.3.4: Extra user configuration of gri-mode

All users should do this at some time.

At this point, gri-mode should start up when you edit a gri file. You may optionally customize gri-mode by:

1. using the Custom interface (see the Help or Gri-Help menu or run the command ``M-x gri-customize`'), or

2. manually setting variables in your ``~/.emacs`' file. These are briefly described by typing ``C-h m`' while in gri-mode. Then, for further infomation, use emacs' ``describe-variable`' command, bound to ``C-h v`'. For example, for more information about the ``gri*WWW-program`' variable, you'd type ``C-h v gri*WWW-program`' (note that emacs does ``Tab`' completion, so pressing the ``Tab`' key after typing-in gri will display all gri related variables.)