aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman2006-02-19 23:38:11 +0000
committerRichard M. Stallman2006-02-19 23:38:11 +0000
commitdf36a07ef048613d662365af32566abf392ffdf7 (patch)
treef3c55bf349608708d60b236d74ae17092b23635d
parent8b77e9ed72d2b4c7f5e9b1eb775e7db45992ebcd (diff)
downloademacs-df36a07ef048613d662365af32566abf392ffdf7.tar.gz
emacs-df36a07ef048613d662365af32566abf392ffdf7.zip
(Using Interactive): Put string case before list case.
-rw-r--r--lispref/commands.texi67
1 files changed, 33 insertions, 34 deletions
diff --git a/lispref/commands.texi b/lispref/commands.texi
index aa05e0a48f2..3b1e9771a1b 100644
--- a/lispref/commands.texi
+++ b/lispref/commands.texi
@@ -150,40 +150,6 @@ It may be omitted or @code{nil}; then the command is called with no
150arguments. This leads quickly to an error if the command requires one 150arguments. This leads quickly to an error if the command requires one
151or more arguments. 151or more arguments.
152 152
153
154@item
155It may be a Lisp expression that is not a string; then it should be a
156form that is evaluated to get a list of arguments to pass to the
157command. Usually this form will call various functions to read input
158from the user, most often through the minibuffer (@pxref{Minibuffer})
159or directly from the keyboard (@pxref{Reading Input}).
160@cindex argument evaluation form
161
162Providing point or the mark as an argument value is also common, but
163if you do this @emph{and} read input (whether using the minibuffer or
164not), be sure to get the integer values of point or the mark after
165reading. The current buffer may be receiving subprocess output; if
166subprocess output arrives while the command is waiting for input, it
167could relocate point and the mark.
168
169Here's an example of what @emph{not} to do:
170
171@smallexample
172(interactive
173 (list (region-beginning) (region-end)
174 (read-string "Foo: " nil 'my-history)))
175@end smallexample
176
177@noindent
178Here's how to avoid the problem, by examining point and the mark after
179reading the keyboard input:
180
181@smallexample
182(interactive
183 (let ((string (read-string "Foo: " nil 'my-history)))
184 (list (region-beginning) (region-end) string)))
185@end smallexample
186
187@item 153@item
188@cindex argument prompt 154@cindex argument prompt
189It may be a string; then its contents should consist of a code character 155It may be a string; then its contents should consist of a code character
@@ -234,6 +200,39 @@ You can use @samp{*} and @samp{@@} together; the order does not matter.
234Actual reading of arguments is controlled by the rest of the prompt 200Actual reading of arguments is controlled by the rest of the prompt
235string (starting with the first character that is not @samp{*} or 201string (starting with the first character that is not @samp{*} or
236@samp{@@}). 202@samp{@@}).
203
204@item
205It may be a Lisp expression that is not a string; then it should be a
206form that is evaluated to get a list of arguments to pass to the
207command. Usually this form will call various functions to read input
208from the user, most often through the minibuffer (@pxref{Minibuffer})
209or directly from the keyboard (@pxref{Reading Input}).
210@cindex argument evaluation form
211
212Providing point or the mark as an argument value is also common, but
213if you do this @emph{and} read input (whether using the minibuffer or
214not), be sure to get the integer values of point or the mark after
215reading. The current buffer may be receiving subprocess output; if
216subprocess output arrives while the command is waiting for input, it
217could relocate point and the mark.
218
219Here's an example of what @emph{not} to do:
220
221@smallexample
222(interactive
223 (list (region-beginning) (region-end)
224 (read-string "Foo: " nil 'my-history)))
225@end smallexample
226
227@noindent
228Here's how to avoid the problem, by examining point and the mark after
229reading the keyboard input:
230
231@smallexample
232(interactive
233 (let ((string (read-string "Foo: " nil 'my-history)))
234 (list (region-beginning) (region-end) string)))
235@end smallexample
237@end itemize 236@end itemize
238 237
239@cindex examining the @code{interactive} form 238@cindex examining the @code{interactive} form