The Emacs commands that are used often or that must be quick to type are bound to keys---short sequences of characters---for convenient use. Other Emacs commands that do not need to be brief are not bound to keys; to run them, you must refer to them by name.
A command name is, by convention, made up of one or more words,
separated by hyphens; for example, auto-fill-mode
or
manual-entry
. The use of English words makes the command name
easier to remember than a key made up of obscure characters, even though
it is more characters to type.
The way to run a command by name is to start with M-x, type the
command name, and finish it with RET
. M-x uses the
minibuffer to read the command name. RET
exits the minibuffer and
runs the command. The string `M-x
' appears at the beginning of the
minibuffer as a prompt to remind you to enter the name of a
command to be run. See Minibuffer, for full information on the
features of the minibuffer.
You can use completion to enter the command name. For example, the
command forward-char
can be invoked by name by typing
M-x forward-char RET
or
M-x forwTAB
cRET
Note that forward-char
is the same command that you invoke with
the key C-f. You can run any Emacs command by name using
M-x, whether or not any keys are bound to it.
If you type C-g while the command name is being read, you cancel the M-x command and get out of the minibuffer, ending up at top level.
To pass a numeric argument to the command you are invoking with M-x, specify the numeric argument before the M-x. M-x passes the argument along to the command it runs. The argument value appears in the prompt while the command name is being read.
If the command you type has a key binding of its own, Emacs mentions
this in the echo area, two seconds after the command finishes (if you
don't type anything else first). For example, if you type M-x forward-word, the message says that you can run the same command more
easily by typing M-f. You can turn off these messages by setting
suggest-key-bindings
to nil
.
Normally, when describing in this manual a command that is run by
name, we omit the RET
that is needed to terminate the name. Thus
we might speak of M-x auto-fill-mode rather than M-x auto-fill-mode RET
. We mention the RET
only when there is
a need to emphasize its presence, such as when we show the command
together with following arguments.
M-x works by running the command
execute-extended-command
, which is responsible for reading the
name of another command and invoking it.
Minibuffer
Top
Help