Back to CFM home             Brown University

Introduction to Emacs

  1. What is Emacs?
  2. In short it is the recommended editor for most of your editing needs unless you are a vi fanatic or you need to edit extremely large files. Actually it's much more than that. Its C(++), Fortran, LISP etc. modes plus built-in version control make it an excellent tool for programmers. TeX, LaTeX etc. modes make editing of papers & theses easier. Moreover it can even be used for sending/reading e-mail, for file manipulation (helpful in case of files whose filenames contain characters that are interpreted by the shell), as a calendar/diary, for reading Usenet News and many other things.

  3. How to start Emacs
  4. The easiest way is to press the left mouse button and select it from the pop-down menu. Or, you can type "emacs &" in a shell.

  5. Special keys
  6. There are two special keys that you will find yourself using over and over in Emacs. They are the "control" key and the "meta" key. The "control" key is easy to find - it's the key with "control" written on it. The control key is usually notated C-, so the notation C-x means "hold down the control key and press x".

    The "meta" key is usually located near the space bar - it's the button with the diamond on top on Suns. For SGIs and other platforms it's denoted as "Alt". If you are logged in from a VT100-compatible terminal the ESC key (at the top left of your keyboard) serves as the "meta" key. This is generally true for other systems as well. The meta key is notated M-, so M-x means "hold down the meta key and press x"

  7. Typing text in Emacs
  8. Just type some stuff. It will insert it. Like most other word processors, Emacs will insert text at the cursor. To delete stuff, use the delete key. Don't use backspace - it may get help depending on your keyboard bindings). Type return whenever you want to start a new line. If you want this to be done automatically for you by the editor then type M-x auto-fill-mode.

  9. Quitting Emacs
  10. C-x C-c exits Emacs. Try it out.

  11. Basic cursor control
  12. Usually the arrow keys and page-up/down keys will work as you would expect them to in Emacs. However, if they don't, you can always use these commands:
    	C-v	Go down one page
    	M-v	Go up one page
    	C-f	Move forward (right) one character
    	C-b	Move backward (left) one character
    	C-n	Move to the next line
    	C-p	Move to the previous line

  13. More advanced cursor control
  14. If you really like moving around in Emacs, here's some more key bindings for you:
    	M-f	Move forward a word
    	M-b	Move backward a word
    	C-a	Move to beginning of line
    	C-e	Move to end of line
    	M-a	Move back to beginning of sentence
    	M-e	Move forward to end of sentence
    	M-<	Go to beginning of file
    	M->	Go to end of file

  15. Files
  16. Here are the basic commands you need to load and save files:

  17. Getting help in Emacs
  18. There are several ways to find help in Emacs:
    	C-h t        runs the tutorial
    	C-h k        describe key (long)
    	C-h c        descibe key (short)
    	C-h C-h C-h  more info

  19. Miscellaneous commands
  20. Listed below are some assorted commands that you may find useful for editing documents:

  21. Don't panic
  22. If you've gotten this far, and you're still wondering how to use Emacs, don't worry. Be sure to run the tutorial. (To do this, type C-h t). It will teach you all the basic skills you need to use Emacs effectively.

  23. More information
  24. If you're insterested in learning more about Emacs, you can try looking at these sites: