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 Preferences > Editor ... from the MLWorks podium. The resulting dialog gives you three ways of specifying an editor:

To use the server, you will need to load some Emacs Lisp code into your Emacs session. You can do this by copying the code in the file envemacs, under the directory where MLWorks is installed, into the file .emacs in your home directory.

You can now make Emacs communicate with MLWorks by typing M-x mlworks-server in Emacs.

Note: If you are running MLWorks across a network, remember to ensure your Emacs session is running on the same host.

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 a UNIX shell or 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.

Note: Your choice of editor, like other preferences from the Preferences menu, can be saved by selecting Preferences > Save Preferences. MLWorks writes the details of your preferences to a file called .mlworks_preferences in your home directory. The preferences file will be read in on starting subsequent MLWorks images.

Suppose that, having set your editor to something acceptable, you invoke File > Use File 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 Action > Edit menu item 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 (UNIX version 1.0) - 3 DEC 1996

Generated with Harlequin WebMaker