Running Emacs

There are various versions of Emacs available on the Undergraduate Computing Laboratory Systems. My personal recommendation is XEmacs (from X, run ``xemacs''). Unfortunately, this version (currently 19.11) only runs under the X Window system, so it won't be much help from a dumb terminal. If that is your situation, then you can run ``xemacs-19.14'' to get a newer version of XEmacs that can run without a graphics connection.

Chapter 9 of Unix for the Impatient is devoted to Emacs. All versions of Emacs have complete on-line documentation, which you can find out how to access by reading the message printed when you run it. (Run the tutorial by typing CTRL-H, then T). They have special editing modes for C programming, as well as for a number of other languages. You can run the C compiler from within Emacs and have the error messages appear in an Emacs buffer. You can use Emacs to read net news and to send and receive electronic mail. It takes a little time to learn the basics, but a little time invested now will be well worth it in the long run.

If you currently use JOVE, it is easy to switch to Emacs, which is much more powerful. One important difference you should be aware of is that whereas JOVE is designed to be started anew each time you want to do editing, Emacs is designed to be started once when you log in. Under X, it brings up a window which you just leave around to use as needed. On a dumb terminal, you can temporarily ``suspend'' Emacs by typing CTRL-Z when you need to get back to the shell. Return to a suspended Emacs by using the shell ``fg'' command. For more information about job control and the shell, see here.

A big advantage of Emacs for software development is that it has a special mode for C programming, which will save you typing by automatically indenting your program. In addition, you can call the C compiler from within an Emacs buffer, and have the error messages displayed on your screen at the same time as your source code, thus speeding the process of correcting errors. Even the GDB debugger can be called from within Emacs, so that when your program stops at a breakpoint, Emacs will automatically read in the appropriate source file and show you the exact point in the code where the breakpoint occurred.

It takes some time to learn Emacs, but if you start now, the time you spend will repay itself by the end of the term. You don't have to learn everything all at once -- it is best to get started with Emacs and then learn a little at a time to speed up your work. When Emacs is first started, it offers to run a tutorial. Start the tutorial by typing ^HT (control-H, then T). The tutorial explains how to change between Emacs buffers, and thus how to go back to normal editing functions once you have entered the tutorial. The tutorial also mentions the use of ``info mode,'' which is the Emacs online documentation reader. Once you have mastered the basic Emacs commands, you will find info mode indispensable for learning about other capabilities of Emacs. Info mode can be entered by the ``M-x info'' command, and itself has a tutorial to explain how to navigate the documentation. The default behavior of Emacs can be modified by placing a .emacs file in your home directory. These files are programs written in a dialect of the Lisp programming language. Unix for the Impatient has more information on .emacs files.