Intro to Using EECS Workstations

Version 2.0
2.1 Text Editting [Back to Homepage]



I. What is Emacs?

Emacs is a text-editor. But you can expand and customize it. Hence, you have a text editor that you can also use for compiling, debugging, writing Chinese, playing Tetris, and who knows what else! Many people make their own extensions and post them on the Web for others to use.


II. Keyboard Shortcuts

Keyboard shortcuts are central to efficient Emacs usage. When you first start using Emacs, it may be easier to use the menu bar. But if you can get used to using keyboard shortcuts, you will find you can do things a lot faster and easier.

The Control and the Meta keys often start off the shortcuts. The Meta key is labeled Alt on most keyboards. In many manuals, they are abbreviated C- and M-. For example, C-x stands for pressing Control and x at the same time, and M-x stands for pressing Alt and x at the same time. If your computer doesn't have Alt for some reason, you can press the ESC key, then the letter x for the same effect.

The Minibuffer is the area on the bottom of the window for completing commands and for displaying messages. You can get out of the Minibuffer by using C-g.


III. Basic File Operations

New file:
  • Under the Files menu, select "Open File..."
  • (Shortcut: C-x C-f).
  • Then, in the minibuffer, type in the name of your new file.
  • Open file:
  • Under the Files menu, select "Open File..."
  • (Shortcut: C-x C-f).
  • Then, in the minibuffer, type in the name of your existing file.
  • Save current buffer:
  • Under the Files menu, select "Save Buffer"
  • (Shortcut: C-x C-s).
  • Cut / Copy / Paste:
  • Under the Edit menu, select "Cut", "Copy", or "Paste".
  • (Shortcut: C-w for Cut).
  • (Shortcut: C-y for Paste).
  • Choose file:
  • When working with multiple files, you can switch between buffers by selecting your choice under the Buffers menu.
  • Alternatively, a cool Ctrl-Tab shortcut extension has been put together by Young-il Choo of Yale, and is described in the Customizing Emacs section.
  • C-x 1 - Work with only one window.
  • C-x 2 - Split the window horizontally in two.
  • C-x 3 - Split the window vertically in two.
  • Close current file:
  • "Closing" a files in Emacs is really "killing" a buffer.
  • Under the Files menu, select "Kill Current Buffer"
  • (Shortcut: C-x k).
  • Exit:
  • Under the Files menu, select "Exit Emacs"
  • (Shortcut: C-x C-c).
  • To learn more Emacs shortcuts, a very good reference is the Tutorial included in Emacs. Go to Help in the menu bar and select "Emacs Tutorial". Or, type C-h t.


    IV. Emacs-style vs. PC-style

    As you can see, these keyboard shortcuts may seem "unusual" to a PC user who usually uses Ctrl-n for New, Ctrl-o for Open, Ctrl-s for Save, Ctrl-x for Cut, Ctrl-c for Copy, Ctrl-v for Paste, etc.

    To that, I have two things to say. The first is that your professors and TAs (and most CS techie people) will urge you to learn the Emacs way because it's just so cool. =) Acutally, I've seen some proficient Emacs typists, and yes, they really do type super fast. So, perhaps making the effort to learn Emacs shortcuts is worth the investment because you'll be able to type really fast (and you'll have the cool factor).

    But the second thing I have to say is that if you'd rather use the PC-style shortcuts you're used to, you can! Emacs is fully customizable, remember?. To see how to do just that (among many other settings you can change), see the section on Customizing Emacs. Using PC-style shortcuts may be very desirable to some users since they're already proficient at it. You'll just have to find some other way to be cool, though. =P

    In the end, it's up to you whether you want to learn Emacs-style or use PC-style shortcuts.


    Learn More:

    • Emacs Tutorial, under the Help menu.
    • A Quick Reference Card for Emacs is available: emacs.ps (60k).
    • To work remotely, see the Connecting From Home section.
    • To customize Emacs, see the Customizing Emacs section.
    • To download Emacs for Windows, here.
    • To run scheme: M-x run-scheme (works on the setup for CS61a accounts).
    • To compile: C-x c
    • To play tetris (hehe): M-x tetris
    ©Copyright 2001, Richard Shiao. All rights reserved. Please send comments to: [email protected]
    Hosted by www.Geocities.ws

    1