Colorado State

Mak's Emacs Tips




One could read this page in one of several ways:

1) There are two camps of editor fanatics in the world: Those who use Emacs and those who suffer for their ignorance.

2) I use emacs because I'm not smart enough to use VI.

3) You have not truly lived in peace until you have an editor that loads in less than a second and allows you to do all of the following in the same window without leaving home position on the keyboard: syntax highlight any document according to your preferences, compose a professional document, run shell commands, run your stats package, use a calculator, parse/verify XML docs, compose HTML, program C++, compile and jump to the offending code, write LISP, run your favorite LISP variant, create straightfoward macros to batch process a text file, use regular expressions and spell check on any document, do global or per-instance search-and-replace, et cetera.

4) Don't just take my word for it:

General Tips

Start with the online tutorial

Do the tutorial until you are comfortable

Think of buffers as windows you can't see. Switching between them is just like using Alt-tab in a window manager.

Most Emacs commands are two-key commands and case-sensitive, there is a difference between 'Cntl-x Cntl-b' and 'Cntl-x b' and what they do. The former shows a list of current buffers, the later one prompts you to enter a buffer to make active. See what happens when you add the shift in there....

Use a reference card for emacs while you are learning. Otherwise you'll go nuts!

It takes a bit to get used to the lingo of emacs commands:
  'Meta-x' means press the "Alt" key and 'x'
  'Meta-$' means press the "Alt" key and the "Shift" key and '4'
  'Cntl-x' means press the "Ctrl" key and 'x'
  Its straightforward to see that 'Cntl-x Cntl-c' means hold the "Ctrl" key while you press 'x' then 'c'
  but it is less clear that 'Cntl-u Meta-$' means press 'Cntl-u' then lift 'Cntl-u' before pressing 'Meta-$'

If you are on dumb terminal, the "ESC" key can act as an initial Ctrl for a sequence of digits (don't worry if you have no idea what that means...)

As soon as you learn the bare minimum of Emacs commands, get on the net and copy someone's emacs setup. Feel free to use an old copy of my linux emacs setup or my cygwin emacs setup. The files work with xemacs and emacs so there is some redirection between the .emacs and .xemacs initialization that may look weird at first glance. You'll probably want to take some asprin before opening the tarball -- beware of overwriting your current setup files if you open this in your home directory! As much as I can piece together, the lineage of this particular setup goes something like: Adele Howe, Charlie Ross, Monica Chawathe, Mark Roberts. Some pleasant additions from Andrew Sutton and Chuck Anderson are gratefully acknowledged

Just a warning: after you get used to using emacs and understand how it works, you might actually notice that hours pass while you work. You might even fall in love with your keyboard for the first time in your life. For this reason, be mindful of a few things 1) eat at least one meal a day 2) put some water next to your desk so you increase the odds of taking regular breaks 3) when your leg starts shaking vigorously, take a bathroom break (this involves leaving the keyboard for short periods of time but it won't miss you a bit) 4) Sleep with a teddy bear or something else because drooling on the keyboard will just ruin a good relationship.

Mastering Emacs

Finally, be an informed consumer of emacs and avoid the dreaded emacs pinky. Look at other people's tips for Effective Emacs

For the ultimate in doubling your pleasure (apologies to "Wrigley's"), consider using the terminal multiplexor screen with emacs -nw. If you love the command line as much as I do, you will like this setup.

(Eclipse addendum) I have also started to use Eclipse with the emacs bindings. Not the best, but it is workable. I have yet to see the strength of the code browsing facility that Eclipse provides elsewhere, and java is a joy to write in this editor. Even still, there are some plugins that really help: