<A HREF="manual_c.htm"><img align=center src="contents.gif" ALT="Contents"></A> Up Previous Next

Edit file :edit [<file>]


The :edit command starts an editor program to modify or view a module file. On Windows 95/NT, the editor and interpreter are executed as independent processes. On other systems, the current Hugs session will be suspended while the editor is running. Then, when the editor terminates, the Hugs session will be resumed and any files that have been changed will be reloaded automatically. The -E option should be used to configure Hugs to your preferred choice of editor.

If no filename is specified, then Hugs uses the name of the last file that it tried to load. This allows the :edit command to integrate smoothly with the facilities for loading files.

For example, suppose that you want to load four files, f1.hs, f2.hs, f3.hs and f4.hs into the interpreter, but the file f3.hs contains an error of some kind. If you give the command:

 :load f1 f2 f3 f4
then Hugs will successfully load f1.hs and f2.hs, but will abort the load command when it encounters the error in f3.hs, printing an error message to describe the problem that occured. Now, if you use the command:
 :edit
then Hugs will start up the editor with the cursor positioned at the relevant line of f3.hs (whenever this is possible) so that the error can be corrected and the changes saved in f3.hs. When you close down the editor and return to Hugs, the interpreter will automatically attempt to reload f3.hs and then, if successful, go on to load the next file, f4.hs. So, after just two commands in Hugs, the error in f3.hs has been corrected and all four of the files listed on the original command line have been loaded into the interpreter, ready for use.