Tools for Functional Design and Programming

Getting Emacs and Moscow ML for Windows
Getting sml-mode
Setting up Emacs to use Moscow ML
Setting up Emacs to use Moscow ML at IT-C
Tutorials for Emacs

Getting Emacs and Moscow ML for Windows

Jakob Lichtenberg have made some nifty installation packages for Emacs and Moscow ML. You should also set up Emacs to use Moscow ML.

If you have any problems with these packages let me know and I'll try to fix them (or get Jakob to fix them).

If you dislike the idea of re-packaged software, then here are the links to Moscow ML and Emacs web pages where you can obtain the software for yourself.

You also need sml-mode.

Getting sml-mode

This step is not needed if your Emacs already know about SML files; for example, if you have installed the additional packages for Emacs under windows.

First, you need to download sml-mode from ftp://flint.cs.yale.edu/pub/monnier/sml-mode (get version 3.9.5).

Read the file INSTALL carefully and follow the instructions. Note, to install the package you need to know how to operate make.

Now set up Emacs to use Moscow ML.

Setting up Emacs to use Moscow ML

Emacs be configured to use different SML compilers. We want it to use Moscow ML.

Emacs can be configured by a .emacs file (yes the file starts with an period). Your .emacs file should be placed in your home directory (or C:\ under Windows).

In my .emacs I have the following:

(setq sml-program-name "mosml"
      sml-default-arg "-P full"
      )

To check that everything works try the following:

  1. Open a file (say firstcode.sml) and check that Emacs goes into SML mode.
  2. Write some SML code in your file (for example, the fact function.
  3. Press C-c C-s to start the toplevel (that is, press Control and hold it down while you press c and then (still holding Control down) s).

    Emacs should now ask you: ML command: mosml (see the buttom of the Emacs window) to acknowledge this just press Enter.

    Emacs should now ask you: Any args: -P full. Again just press Enter.

    Voila, you should now have a split screen with the toplevel at the buttom.

  4. To send you SML code to the toplevel. First, bring your cursor back to the top part of the Emacs window. Then, press C-c C-b.
  5. The short-cut for switching between the top and the buttom part of the Emacs window is C-x o (that is, press Control and hold it down while you press x then let go of Control and press o).

Setting up Emacs to use Moscow ML at IT-C

Due to some miscommunications between SysAdm and me it is a wrong version of sml-mode that is installed at IT-C. Thus, the instructions above does not work at IT-C. (Yet, they will in a couple of weeks...).

Here is how I got the sml-mode installed to (somewhat) work:

  1. Put the following in your .emacs (if you don't have an .emacs file then make one in your home directory)
    ; Get syntax highlighting in must modes
    (global-font-lock-mode 1)
    
    ; For sml-mode 3.2
    (eval-after-load "sml-mode" '(require 'sml-font))
    
    (autoload 'sml-mosml "sml-mosml" "Set up and run Moscow ML." t)
    (autoload 'sml "sml-proc" "Run an inferior ML process." t)
    
    (setq sml-electric-semi-mode ()
          sml-dedicated-frame    nil
          sml-font-lock-auto-on  nil
          sml-hilite             nil
          )
    ; For all(?) sml-modes
    (setq sml-program-name "mosml"
          sml-default-arg "-P full"
          )
      
  2. Open a file (say firstcode.sml) and check that Emacs goes into SML mode.
  3. Write some SML code in your file (for example, the fact function.
  4. Choose the menu-item SML -> Process -> Start default ML compiler.
  5. Press C-c C-s to get a split screen with the toplevel at the buttom. (That is, press Control and hold it down while you press c and then (still holding Control down) s).
  6. To send you SML code to the toplevel. First, bring your cursor back to the top part of the Emacs window. Then, press C-c C-b.
  7. The short-cut for switching between the top and the buttom part of the Emacs window is C-x o (that is, press Control and hold it down while you press x then let go of Control and press o).

Tutorials for Emacs

First start with Getting started with Emacs from LinuxLab. The information in this guide works equally well under Windows (except for the spell checking part). Emacs also comes with a tutorial that can be accessed from the Help menu.
Author: Ken Friis Larsen(kfl@it-c.dk)
Last modified: September 3, 2002