Environment options
Before options on the command line are processed, initial option
values are set from the environment. On Windows 95/NT, these
settings are added to the registry during setup.
On other systems, the initial settings are
determined by the HUGSFLAGS environment
variable. The syntax used in this case
is the same as on the command line: options are single letters,
preceeded by + or -, and sometimes followed by a value.
Option settings are separated by
spaces; option values containing spaces are encoded using
Haskell string syntax. The environment should be set up before
the interpreter is used so
that the search path is correctly defined to include the prelude.
The built-in defaults, however, may allow Hugs to be run without any
help from the environment on most systems.
It is usually more convenient to save preferred option settings in
the environment rather than specifying them on the command line;
they will then be used
automatically each time the
interpreter is started. The method for setting these options depends on
the machine and operating system that you are using, and on the way that
the Hugs system was installed. The following examples show some typical
settings for Unix machines and PCs:
- The method for setting HUGSFLAGS on a Unix
machine depends on the choice of shell. For example, a C-shell user might
add something like the following to their .cshrc file:
set HUGSFLAGS -E"vi +%d %s"
The string quotes are necessary for the
value of the E option becauses it contains spaces.
The editor specified here is vi, which allows the
user to specify a startup line number by preceding it with
a + character. The settings are easily changed to accommodate
other editors. For example, if you want to use
emacsclient instead of vi, just
specify emacsclient instead of vi and add the following line
to your ~/.emacs file:
(server-start)
If you are installing Hugs for the benefit of several different
users, then you should probably use a script
file that sets appropriate values for the environment variables, and
then invokes the interpreter:
#!/bin/sh
HUGSFLAGS=-E"vi +%d %s" +s
export HUGSFLAGS
exec /usr/local/bin/hugs $*
One advantage of this approach is that individual users do not have
to worry about setting the environment variables themselves. In
addition to the E option, other options---such as
and +s or -P---can be set.
It is easy for more advanced users to copy and customize a script like
this to suit their own needs.
- Users of DOS or Windows 3.1 might add the following line
to autoexec.bat:
set HUGSFLAGS=-E"vi +%%d %%s"
The setting for the editor will only work if
you have installed the editor program, in this case vi, that it
refers to.
- On Windows 95/NT, the setup program initializes the
environment, and this can be changed subsequently (on these systems only)
by using either the :set command or a registry editor.
Installed options are stored
under the HKEY_LOCAL_MACHINE key; changes to these options
using :set are placed under HKEY_CURRENT_USER so that
different users do not alter each other's options.
For completeness, we should also mention the other environment variables
that are used by Hugs:
- The SHELL variable on a Unix machine, or
the COMSPEC variable on a DOS machine, determines which
shell is used by the :! command.
- The EDITOR variable is used to try and locate an editor
if no editor option has been set. Note, however, that
this variable does not normally provide the extra information that is
needed to be able to start the editor at a specific line in the input file.