One of the benefits of using the one true editor (that's EMACS you heathens!) is that you get more features than you ever knew you'd need. One of these features is hippie-expand, written by Anders Holst.

Basically, when you invoke hippie-expand, it tries to expand (much like tab completion the word you are currently typing by matching it against

  • file names - hippie-expand scans your file system to see if it looks like you are trying to type the name of a file or directory.
  • the current buffer - hippie-expand looks in the current buffer (and other buffers on failure) to see if the word you are typing matches an already existing one.
  • exact line match - hippie-expand checks if there exist lines with the current line as prefix.
  • the kill buffer - hippie-expand also scans the kill ring to see the text there matches what you are typing.
All in all, it's an extremely useful feature, especially if you are coding and have to use long variable names. It's not turned on by default, but that's easily remedied if you stick something like
(global-set-key (quote [167]) (quote hippie-expand))
in your .emacs file. This particular example ties hippie-expand to the key above TAB and to the left of 1 on a swedish keyboard (no-one ever uses that key anyway).