Shortcuts

Buffer

Command Description
<C-x> h Selects the entire buffer.
<C-x> s Show diff for current buffer then prompt to save.
<C-x> <C-s> Save current buffer.
<C-x> k Kill current buffer.
<M-x> recover-file Recovers unsaved content.
  • Emacs saves content in buffer every 300 keystrokes by default.

Command Description
<C-x> b Display mini buffer list and switch to buffer.
<C-x> <C-b> Display full buffer list. Use d to mark any buffer need to be killed.
<M-x> clean-buffer-list Kill unused buffers.

Saving Files on Exit

Command Description
y Save the specified file.
n Don't save the specified file.
! Save all the remaining files.
q Quit immediately without saving.
. Save the specified file then quit.
<C-r> View the specified file.
<C-h> View help information.

Casing

Command Description
<M-u> Make word uppercase.
<M-c> Make word capitalized.
<M-l> Make word lowercase.
<C-x> <C-u> Make region uppercase.
<C-x> <C-l> Make region lowercase.

Macros

Command Description
<f3> Start recording macro.
<f4> Stop recording macro.
<f4> or <C-x> e Execute last macro.
<C-u> <f3> Execute last macro and append keys to it.
<C-u> <C-u> <f3> Append keys to last macro without executing it.
<C-x> <C-k> r Execute last macro on each line that begins in the region.

Other

Command Description
<C-x> <C-+> Increases font size.
<C-h> b Opens up possible keyboard bindings (b stands for "buffers").
<C-x> o Switches between frames.
<C-x> 0 Closes current frame.
<C-h> k [key-binding] Brings up help information about given key-binding (e.g.: <C-h> k <C-x> b).
<C-h> a [command-name] Brings up help information about command name (e.g.: <C-h> a buffer).
<C-x> <C-q> Toggle read-only mode.

General

  • Every emacs command is a Lisp function.

  • An input event is anything you can do to send input to the computer.

  • A key sequence is a series of input events that, taken as a unit, have meaning.

  • The connection between a key sequence and the command it invokes is called a key binding.

  • For commands without a key binding, invoke the command explicitly by typing <M-x> then the command name.

Mode Line

Characters Meaning
-- Buffer has not been modified.
** Buffer has been modified (not yet saved).
%% Read-only mode: buffer has not been modified.
%* Read-only mode: buffer has been modified.