annotate man/m-x.texi @ 76185:b6efdc75a68e

*** empty log message ***
author Glenn Morris <rgm@gnu.org>
date Tue, 27 Feb 2007 03:34:25 +0000
parents 4ad431d8e164
children 02b9a9aa5b0c 95d0cdf160ea
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
1 @c This is part of the Emacs manual.
75249
4ad431d8e164 Update copyright for years from Emacs 21 to present (mainly adding
Glenn Morris <rgm@gnu.org>
parents: 71592
diff changeset
2 @c Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1997, 2001, 2002,
4ad431d8e164 Update copyright for years from Emacs 21 to present (mainly adding
Glenn Morris <rgm@gnu.org>
parents: 71592
diff changeset
3 @c 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
4 @c See file emacs.texi for copying conditions.
Dave Love <fx@gnu.org>
parents:
diff changeset
5 @node M-x, Help, Minibuffer, Top
Dave Love <fx@gnu.org>
parents:
diff changeset
6 @chapter Running Commands by Name
Dave Love <fx@gnu.org>
parents:
diff changeset
7
71585
2bce43489a02 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 68639
diff changeset
8 Every Emacs command has a name that you can use to run it. For
2bce43489a02 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 68639
diff changeset
9 convenience, many commands also have key bindings. You can run those
2bce43489a02 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 68639
diff changeset
10 commands by typing the keys, or run them by name. Most Emacs commands
2bce43489a02 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 68639
diff changeset
11 have no key bindings, so the only way to run them is by name.
2bce43489a02 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 68639
diff changeset
12 (@xref{Key Bindings}, for how to set up key bindings.)
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
13
36726
d18a841a4a5a Clarify key bindings vs running a command by name.
Richard M. Stallman <rms@gnu.org>
parents: 36658
diff changeset
14 By convention, a command name consists of one or more words,
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
15 separated by hyphens; for example, @code{auto-fill-mode} or
71585
2bce43489a02 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 68639
diff changeset
16 @code{manual-entry}. Command names mostly use complete English words
2bce43489a02 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 68639
diff changeset
17 to make them easier to remember.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
18
Dave Love <fx@gnu.org>
parents:
diff changeset
19 @kindex M-x
71585
2bce43489a02 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 68639
diff changeset
20 To run a command by name, start with @kbd{M-x}, type the command
2bce43489a02 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 68639
diff changeset
21 name, then terminate it with @key{RET}. @kbd{M-x} uses the minibuffer
2bce43489a02 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 68639
diff changeset
22 to read the command name. The string @samp{M-x} appears at the
2bce43489a02 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 68639
diff changeset
23 beginning of the minibuffer as a @dfn{prompt} to remind you to enter a
2bce43489a02 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 68639
diff changeset
24 command name to be run. @key{RET} exits the minibuffer and runs the
2bce43489a02 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 68639
diff changeset
25 command. @xref{Minibuffer}, for more information on the minibuffer.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
26
71592
78e1e4fcd148 (M-x): Fix.
Romain Francoise <romain@orebokech.com>
parents: 71585
diff changeset
27 You can use completion to enter the command name. For example,
71585
2bce43489a02 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 68639
diff changeset
28 to invoke the command @code{forward-char}, you can type
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
29
Dave Love <fx@gnu.org>
parents:
diff changeset
30 @example
Dave Love <fx@gnu.org>
parents:
diff changeset
31 M-x forward-char @key{RET}
Dave Love <fx@gnu.org>
parents:
diff changeset
32 @end example
Dave Love <fx@gnu.org>
parents:
diff changeset
33
Dave Love <fx@gnu.org>
parents:
diff changeset
34 @noindent
Dave Love <fx@gnu.org>
parents:
diff changeset
35 or
Dave Love <fx@gnu.org>
parents:
diff changeset
36
Dave Love <fx@gnu.org>
parents:
diff changeset
37 @example
Dave Love <fx@gnu.org>
parents:
diff changeset
38 M-x forw @key{TAB} c @key{RET}
Dave Love <fx@gnu.org>
parents:
diff changeset
39 @end example
Dave Love <fx@gnu.org>
parents:
diff changeset
40
Dave Love <fx@gnu.org>
parents:
diff changeset
41 @noindent
Dave Love <fx@gnu.org>
parents:
diff changeset
42 Note that @code{forward-char} is the same command that you invoke with
71585
2bce43489a02 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 68639
diff changeset
43 the key @kbd{C-f}. The existence of a key binding does not stop you
2bce43489a02 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 68639
diff changeset
44 from running the command by name.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
45
71585
2bce43489a02 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 68639
diff changeset
46 To cancel the @kbd{M-x} and not run a command, type @kbd{C-g} instead
2bce43489a02 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 68639
diff changeset
47 of entering the command name. This takes you back to command level.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
48
Dave Love <fx@gnu.org>
parents:
diff changeset
49 To pass a numeric argument to the command you are invoking with
71585
2bce43489a02 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 68639
diff changeset
50 @kbd{M-x}, specify the numeric argument before @kbd{M-x}. The
2bce43489a02 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 68639
diff changeset
51 argument value appears in the prompt while the command name is being
2bce43489a02 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 68639
diff changeset
52 read, and finally @kbd{M-x} passes the argument to that command.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
53
Dave Love <fx@gnu.org>
parents:
diff changeset
54 @vindex suggest-key-bindings
71585
2bce43489a02 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 68639
diff changeset
55 When the command you run with @kbd{M-x} has a key binding, Emacs
2bce43489a02 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 68639
diff changeset
56 mentions this in the echo area after running the command. For
2bce43489a02 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 68639
diff changeset
57 example, if you type @kbd{M-x forward-word}, the message says that you
2bce43489a02 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 68639
diff changeset
58 can run the same command by typing @kbd{M-f}. You can turn off these
68511
01315c421f31 (M-x): Minor clarifications
Richard M. Stallman <rms@gnu.org>
parents: 64890
diff changeset
59 messages by setting the variable @code{suggest-key-bindings} to
01315c421f31 (M-x): Minor clarifications
Richard M. Stallman <rms@gnu.org>
parents: 64890
diff changeset
60 @code{nil}.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
61
71585
2bce43489a02 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 68639
diff changeset
62 In this manual, when we speak of running a command by name, we often
2bce43489a02 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 68639
diff changeset
63 omit the @key{RET} that terminates the name. Thus we might say
2bce43489a02 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 68639
diff changeset
64 @kbd{M-x auto-fill-mode} rather than @kbd{M-x auto-fill-mode
2bce43489a02 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 68639
diff changeset
65 @key{RET}}. We mention the @key{RET} only for emphasis, such as when
2bce43489a02 Lots of cleanups.
Richard M. Stallman <rms@gnu.org>
parents: 68639
diff changeset
66 the command is followed by arguments.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
67
Dave Love <fx@gnu.org>
parents:
diff changeset
68 @findex execute-extended-command
Dave Love <fx@gnu.org>
parents:
diff changeset
69 @kbd{M-x} works by running the command
Dave Love <fx@gnu.org>
parents:
diff changeset
70 @code{execute-extended-command}, which is responsible for reading the
Dave Love <fx@gnu.org>
parents:
diff changeset
71 name of another command and invoking it.
52401
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 36726
diff changeset
72
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 36726
diff changeset
73 @ignore
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 36726
diff changeset
74 arch-tag: b67bff53-9628-4666-b94e-eda972a7ba56
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 36726
diff changeset
75 @end ignore