* lisp/textmodes/rst.el (electric-pair-pairs): Declare.
[bpt/emacs.git] / doc / emacs / m-x.texi
CommitLineData
6bf7aab6 1@c This is part of the Emacs manual.
ba318903 2@c Copyright (C) 1985-1987, 1993-1995, 1997, 2001-2014 Free Software
ab422c4d 3@c Foundation, Inc.
6bf7aab6 4@c See file emacs.texi for copying conditions.
abb9615e 5@node M-x
6bf7aab6
DL
6@chapter Running Commands by Name
7
1abade00
RS
8 Every Emacs command has a name that you can use to run it. For
9convenience, many commands also have key bindings. You can run those
10commands by typing the keys, or run them by name. Most Emacs commands
11have no key bindings, so the only way to run them is by name.
12(@xref{Key Bindings}, for how to set up key bindings.)
6bf7aab6 13
3c39a24c 14 By convention, a command name consists of one or more words,
6bf7aab6 15separated by hyphens; for example, @code{auto-fill-mode} or
1abade00
RS
16@code{manual-entry}. Command names mostly use complete English words
17to make them easier to remember.
6bf7aab6
DL
18
19@kindex M-x
1abade00
RS
20 To run a command by name, start with @kbd{M-x}, type the command
21name, then terminate it with @key{RET}. @kbd{M-x} uses the minibuffer
22to read the command name. The string @samp{M-x} appears at the
23beginning of the minibuffer as a @dfn{prompt} to remind you to enter a
24command name to be run. @key{RET} exits the minibuffer and runs the
25command. @xref{Minibuffer}, for more information on the minibuffer.
6bf7aab6 26
33cd9ed8 27 You can use completion to enter the command name. For example,
1abade00 28to invoke the command @code{forward-char}, you can type
6bf7aab6
DL
29
30@example
31M-x forward-char @key{RET}
32@end example
33
34@noindent
35or
36
37@example
38M-x forw @key{TAB} c @key{RET}
39@end example
40
41@noindent
42Note that @code{forward-char} is the same command that you invoke with
1abade00
RS
43the key @kbd{C-f}. The existence of a key binding does not stop you
44from running the command by name.
6bf7aab6 45
1abade00
RS
46 To cancel the @kbd{M-x} and not run a command, type @kbd{C-g} instead
47of entering the command name. This takes you back to command level.
6bf7aab6
DL
48
49 To pass a numeric argument to the command you are invoking with
1abade00
RS
50@kbd{M-x}, specify the numeric argument before @kbd{M-x}. The
51argument value appears in the prompt while the command name is being
52read, and finally @kbd{M-x} passes the argument to that command.
6bf7aab6
DL
53
54@vindex suggest-key-bindings
1abade00
RS
55 When the command you run with @kbd{M-x} has a key binding, Emacs
56mentions this in the echo area after running the command. For
57example, if you type @kbd{M-x forward-word}, the message says that you
58can run the same command by typing @kbd{M-f}. You can turn off these
9f528ded
RS
59messages by setting the variable @code{suggest-key-bindings} to
60@code{nil}.
6bf7aab6 61
1abade00
RS
62 In this manual, when we speak of running a command by name, we often
63omit the @key{RET} that terminates the name. Thus we might say
64@kbd{M-x auto-fill-mode} rather than @kbd{M-x auto-fill-mode
65@key{RET}}. We mention the @key{RET} only for emphasis, such as when
66the command is followed by arguments.
6bf7aab6
DL
67
68@findex execute-extended-command
69 @kbd{M-x} works by running the command
70@code{execute-extended-command}, which is responsible for reading the
71name of another command and invoking it.