[   ^ to index...   |   <-- previous   |   next -->   ]

Emacs SML mode

At startup, Emacs searches for a file called .emacs (or, on Windows systems, _emacs) in the user's home directory. This file contains Emacs Lisp code that is to be executed whenever Emacs starts.

In order to get Emacs to work with SML/NJ, you will need to create a .emacs file in your Unix home directory (you should start in this directory when you login to a Unix host).

At this point, you need to know how to load and edit files in Emacs:

Loading, editing, and closing files

C-x C-f is the keyboard shortcut for "find file" (equivalent to "open file" in a traditional office application). You will be prompted in the minibuffer for a filename; type .emacs to begin.

Emacs will open fresh buffer named .emacs. You should now add Emacs Lisp code to this file so that it can load the SML mode files; the exact changes are documented on the course web page's "Using SML/NJ" section).

Now, you want to save your changes. Hit C-x C-s to save the buffer to the file. If you wish to "kill" the current buffer, hit C-x k. This is roughly equivalent to "closing a file" in a traditional office application.

SML mode

You need to restart Emacs, so that it can load the .emacs on startup. Hit C-x C-c to quit, then start up emacs from the command prompt.

Now, try opening a file called "first.sml". The modeline should say SML mode. You can now type SML code, and it will help you with indentation if you hit TAB:

[GNU Emacs in sml-mode]


Keunwoo Lee
Last modified: Wed Mar 28 21:48:54 PST 2001