Emacs Principle, Command and Keys

By Xah Lee. Date: . Last updated: .

Everything is a Command

In emacs, every keystroke executes a command. For example, when you type a key e, emacs actually runs the command self-insert-command.

Any key or key combination sequence you press ultimately calls a command.

There are over 3 thousand commands in emacs by default.

Most commonly used commands have a keyboard shortcut, such as moving the cursor, opening file, copy paste, close a file, search text.

To run a command by name, type Alt+x followed by the command name.

Alt+x execute-extended-command
Execute a command by name
keyboard-quitCtrl+g
Cancel a command in progress, or cancel unfinished keyboard keystroke sequence

Find What a Key Do

Alt+x describe-keyCtrl+h k
Prompt to type a key shortcut, then show command name and doc bound to that key.

Find a Command's Key

Alt+x describe-functionCtrl+h f
Prompt to type a command name, it'll shows the command's key, if any.

How to find a command

Alt+x apropos-command
Search command by name.

View Current Major Mode's Documentation

Alt+x describe-mode
Show current major mode's documentation.

Emacs Principle