emacs tutorial
Home : Emacs tips :
Tutorial outline
Outline of an emacs tutorial presented 4-Oct-99 at the October 1999
ArsDigita web
developers' bootcamp by Bob Rogers.
[Developed in collaboration with Farshad Nayeri, who gave an emacs
tutorial at the previous bootcamp.]
Getting started
- starting and exiting emacs (C-x C-c)
- window layout (windows, mode line, minibuffer, scroll bars)
- control and meta modify command characters
- Keyboard control shift is abbreviated
"C-"; e.g. "C-x"
- "Alt" keys (diamond keys on either side of space bar on
Sparcs) are abbreviated "M-" (pronounced "meta"),
e.g. "M-x"
- "M-" can also be typed with the ESC or
"escape" key.
- most common commands are invoked by single keystrokes
- standard prefixes are used to cram in more commands:
- C-x is usually for "big" commands -- file,
buffer, window manipulation
- C-c is usually for language-specific commands
- C-h is for help commands
- M-x invokes commands by name
- getting unstuck (C-g, ESC ESC ESC,
C-z lossage)
- reading and writing files (C-x C-f,
C-x C-s, C-x C-w, typing file names
with completion in the minibuffer)
- basic cursor motion:
- line (C-n, C-p, C-a, C-e)
- character (C-f, C-b)
- word (M-f, M-b)
- buffer (M->, M-<)
See the cheat sheet for more.
- point and mark, cut and copy (C-@, C-w,
M-w)
- inserting and deleting text (DEL, C-d,
C-k, etc.)
- infinite undo/redo (C-x u or C-_; it's the
same command)
- "yanking" (pasting) killed text (C-y, M-y)
- scrolling (C-v, M-v, C-l)
- mouse marking, scrolling (C-w)
- searching, text replace (C-s, C-r,
M-x replace-string,
M-x query-replace)
- more cursor motion (M-a, M-e for sentences,
M-{, M-} for paragraphs)
Getting around
- multiple buffers (C-x b, C-x k,
C-x C-b, C-x s)
- multiple windows (C-x 1, C-x 2,
C-x o, C-M-v)
- getting help
- C-h a lists matching functions and brief
documentation
- C-h l is "describe lossage" -- lists the
last 100 keystrokes
- C-h k
- C-h m documents buffer modes
- mode line, major modes, minor modes (e.g. auto fill)
- shell-mode (M-x shell, M-p; see also the
Running a shell within emacs
tips)
- tcl-mode intro (see also the Editing Tcl source code tips)
- info and the online emacs manual (C-h i)
- crash recovery (M-x recover-file,
M-x recover-session)
More advanced commands
[These won't be covered at the bootcamp presentation.]
- indentation (TAB in language modes,
C-x C-i)
- expression commands (C-M-f, C-M-b,
C-M-k, C-M-q, etc)
- C-x ESC ESC
(M-x repeat-complex-command)
- finding source code definitions (M-.,
M-x visit-tags-table, etags program)
- dired (C-x d) and dired mode
- keyboard macros (C-x (, C-x ))
- mark ring (C-x C-x, C-@, C-SPC)
- C-x m (mail)
More advanced concepts and tools
[These won't be covered at the bootcamp presentation.]
- regexp searching (C-M-s, C-M-r, emacs regexps)
- "grepping" (M-x grep, C-x `)
- compiling (M-x compile, C-x `)
- frames (C-x 5 prefix)
- rectangle commands (C-x r prefix)
- ange-ftp (Internet file access)
- VC support
- leim
- mail-reading programs (several are available)
Bob Rogers
<rogers@darwin.bu.edu>
Last modified: Sat Jun 25 18:34:05 EDT 2011