annotate man/xemacs/m-x.texi @ 5936:574f0cded429 cygwin

try to replace all nnnL or nnnUL constants with EMACS_[U]INT
author Henry Thompson <ht@markup.co.uk>
date Sun, 13 Dec 2015 13:22:58 +0000
parents 3ecd8885ac67
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2 @node M-x, Help, Minibuffer, Top
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3 @chapter Running Commands by Name
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
4
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
5 The Emacs commands that are used often or that must be quick to type are
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
6 bound to keys---short sequences of characters---for convenient use. Other
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
7 Emacs commands that are used more rarely are not bound to keys; to run
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
8 them, you must refer to them by name.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
9
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
10 A command name consists, by convention, of one or more words,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
11 separated by hyphens: for example, @code{auto-fill-mode} or
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
12 @code{manual-entry}. The use of English words makes the command name
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
13 easier to remember than a key made up of obscure characters, even though
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
14 it results in more characters to type. You can run any command by name,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
15 even if it can be run by keys as well.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
16
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
17 @kindex M-x
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
18 @cindex minibuffer
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
19 To run a command by name, start with @kbd{M-x}, then type the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
20 command name, and finish with @key{RET}. @kbd{M-x} uses the minibuffer
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
21 to read the command name. @key{RET} exits the minibuffer and runs the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
22 command.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
23
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
24 Emacs uses the minibuffer for reading input for many different purposes;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
25 on this occasion, the string @samp{M-x} is displayed at the beginning of
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
26 the minibuffer as a @dfn{prompt} to remind you that your input should be
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
27 the name of a command to be run. @xref{Minibuffer}, for full information
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
28 on the features of the minibuffer.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
29
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
30 You can use completion to enter a command name. For example, to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
31 invoke the command @code{forward-char}, type:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
32
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
33 @example
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
34 M-x forward-char @key{RET}
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
35 @end example
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
36 or
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
37 @example
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
38 M-x fo @key{TAB} c @key{RET}
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
39 @end example
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
40
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
41 @noindent
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
42 After you type in @code{M-x fo TAB} emacs will give you a possible list of
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
43 completions from which you can choose. Note that @code{forward-char} is the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
44 same command that you invoke with the key @kbd{C-f}. You can call any
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
45 command (interactively callable function) defined in Emacs by its name
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
46 using @kbd{M-x} regardless of whether or not any keys are bound to it.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
47
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
48 If you type @kbd{C-g} while Emacs reads the command name, you cancel
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
49 the @kbd{M-x} command and get out of the minibuffer, ending up at top level.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
50
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
51 To pass a numeric argument to a command you are invoking with
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
52 @kbd{M-x}, specify the numeric argument before the @kbd{M-x}. @kbd{M-x}
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
53 passes the argument along to the function that it calls. The argument
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
54 value appears in the prompt while the command name is being read.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
55
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
56 @findex interactive
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
57 You can use the command @code{M-x interactive} to specify a way of
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
58 parsing arguments for interactive use of a function. For example, write:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
59
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
60 @example
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
61 (defun foo (arg) "Doc string" (interactive "p") ...use arg...)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
62 @end example
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
63
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
64 to make @code{arg} be the prefix argument when @code{foo} is called as a
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
65 command. The call to @code{interactive} is actually a declaration
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
66 rather than a function; it tells @code{call-interactively} how to read
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
67 arguments to pass to the function. When actually called, @code{interactive}
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
68 returns @code{nil}.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
69
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
70 The argument of @var{interactive} is usually a string containing a code
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
71 letter followed by a prompt. Some code letters do not use I/O to get
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
72 the argument and do not need prompts. To prompt for multiple arguments,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
73 you must provide a code letter, its prompt, a newline, and another code
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
74 letter, and so forth. If the argument is not a string, it is evaluated
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
75 to get a list of arguments to pass to the function. If you do not provide an
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
76 argument to @code{interactive}, no arguments are passed when calling
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
77 interactively.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
78
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
79 Available code letters are:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
80
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
81 @table @code
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
82 @item a
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
83 Function name: symbol with a function definition
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
84 @item b
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
85 Name of existing buffer
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
86 @item B
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
87 Name of buffer, possibly nonexistent
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
88 @item c
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
89 Character
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
90 @item C
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
91 Command name: symbol with interactive function definition
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
92 @item d
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
93 Value of point as number (does not do I/O)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
94 @item D
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
95 Directory name
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
96 @item e
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
97 Last mouse event
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
98 @item f
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
99 Existing file name
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
100 @item F
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
101 Possibly nonexistent file name
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
102 @item k
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
103 Key sequence (string)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
104 @item m
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
105 Value of mark as number (does not do I/O)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
106 @item n
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
107 Number read using minibuffer
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
108 @item N
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
109 Prefix arg converted to number, or if none, do like code @code{n}
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
110 @item p
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
111 Prefix arg converted to number (does not do I/O)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
112 @item P
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
113 Prefix arg in raw form (does not do I/O)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
114 @item r
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
115 Region: point and mark as two numeric arguments, smallest first (does
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
116 not do I/O)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
117 @item s
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
118 Any string
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
119 @item S
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
120 Any symbol
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
121 @item v
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
122 Variable name: symbol that is @code{user-variable-p}
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
123 @item x
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
124 Lisp expression read but not evaluated
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
125 @item X
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
126 Lisp expression read and evaluated
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
127 @end table
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
128
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
129 In addition, if the string begins with @samp{*}, an error is
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
130 signaled if the buffer is read-only. This happens before reading any
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
131 arguments. If the string begins with @samp{@@}, the window the mouse is
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
132 over is selected before anything else is done. You may use both
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
133 @samp{@@} and @samp{*}; they are processed in the order that they appear.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
134
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
135 Normally, when describing a command that is run by name, we omit the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
136 @key{RET} that is needed to terminate the name. Thus we may refer to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
137 @kbd{M-x auto-fill-mode} rather than @kbd{M-x auto-fill-mode} @key{RET}.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
138 We mention the @key{RET} only when it is necessary to emphasize its
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
139 presence, for example, when describing a sequence of input that contains
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
140 a command name and arguments that follow it.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
141
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
142 @findex execute-extended-command
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
143 @kbd{M-x} is defined to run the command @code{execute-extended-command},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
144 which is responsible for reading the name of another command and invoking
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
145 it.