Emacs FAQ

Frequently asked questions

Going to a specific line number

To go to a specific line in an emacs file, type
   M-x goto-line

then press the return key, then supply the line number at the prompt. A better way, however, is to "bind" the goto-line command to a key. To do this, add the line

  (global-set-key "\M-#" 'goto-line)

to your .emacs file. Then you can type C-u 2317 ESC-# to go to line 2317.

A filename shortcut

When you type C-x C-f (find-file), you then have to supply the file name. It is easy to make mistakes, and typing long names is a pain. Try this instead:

Type the first part of the name, then <spacebar>. Emacs will try to fill out the rest of the name. If it can't supply the full name, give it a character or two more, then press <spacebar> again.

A long word shortcut

If you type M-/ (dabbrev-expand) after a partial word, emacs will expand it to the most recent word that matches. If the expansion is not the desired one, just type M-/ repeatedly until you find the one you want. This saves a lot of time in entering long technical words.