Next Previous Up Top Contents Index

1 Using MLWorks interactively

1.9 Editing ML files

When MLWorks identifies an error in an ML file, one of the options it makes available is to load the file into your chosen editor at the line containing the error. To specify the editor you want to use, select Usage > General Preferences > Editor ... from the menu bar. The resulting dialog gives you several ways of specifying an editor:

Use the External Editor text box to specify a command that would invoke a suitable editor if you typed it at the operating system command line (that is, in an MS-DOS window). When you ask MLWorks to edit a file, it starts a new window in which the given command line, with the name of the file to be edited appended, is executed. If the command line includes %l, MLWorks will substitute an appropriate line number.
The Windows editor Wordpad is the default editor, and is assumed to be in c:\Program Files\Accessories\. This is the default location for the editor usder Windows 95, but Windows NT 4.0 users may have to specify c:\Program Files\Windows NT\Accessories\ as the editor location.

Note: Your choice of editor, like other settings and preferences selected from the Usage menu, can be saved by selecting Usage > Save Preferences. MLWorks writes the details of your preferences to a file called .mlworks_preferences in your home directory (your home directory is specified by the environment variable HOME. To see or change this environment variable, see the System view in the control panel). The preferences file will be read in on starting subsequent MLWorks images.

Suppose that, having set your editor to something acceptable, you invoke File > Read Into Listener to run a file which contains an error. MLWorks reports the error in the listener, and brings up the error browser.

MLWorks> use "error.sml";
val it : unit = ()
Use: error.sml
error.sml:3,9 to 3,11: error: Unbound value boo

All errors in the first erroneous declaration in the file will be found, and they may be browsed in the usual way. The actions available are the same as when any error is encountered, with one exception: the Edit button on the error browser will start up your chosen editor, passing it the line number containing the error currently selected in the error browser.

Alternatively, you can position the cursor on the line in the listener where the location of the error is given, and select Edit > Edit Error. Again, MLWorks will start up your chosen editor at the line containing the error. This method allows you to edit a file containing an error even when you have switched off error browsers.

Editor settings and preferences can be controlled programmatically by the Shell.Editor and Shell.Options.Preferences structures. For full details, see the MLWorks Reference Manual.

1.9.1 - Custom editors

MLWorks User Guide version 2.0 for Windows - 30 Jul 1998

Next Previous Up Top Contents Index

Generated with Harlequin WebMaker