summaryrefslogtreecommitdiff
path: root/lispref/commands.texi
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1995-02-25 20:57:45 +0000
committerRichard M. Stallman <rms@gnu.org>1995-02-25 20:57:45 +0000
commit0a6e15d4f9789e3b926a3273f3f02b325a8cab93 (patch)
tree78a2e5defc03ce35bb39be2c84dacdb247fd7c44 /lispref/commands.texi
parent07ba9e79eda4ebc680600f3a5bfeef81e16143c0 (diff)
downloademacs-0a6e15d4f9789e3b926a3273f3f02b325a8cab93.tar.gz
Warn that interactive should get point and mark only after minibuffer input.
Diffstat (limited to 'lispref/commands.texi')
-rw-r--r--lispref/commands.texi25
1 files changed, 25 insertions, 0 deletions
diff --git a/lispref/commands.texi b/lispref/commands.texi
index fc9ed30aee3..e95b5599ad3 100644
--- a/lispref/commands.texi
+++ b/lispref/commands.texi
@@ -178,6 +178,31 @@ form that is evaluated to get a list of arguments to pass to the
command.
@cindex argument evaluation form
+If this expression reads keyboard input (this includes using the
+minibuffer), keep in mind that the integer value of point or the mark
+before reading input may be incorrect after reading input. This is
+because the current buffer may be receiving subprocess output;
+if subprocess output arrives while the command is waiting for input,
+it could relocate point and the mark.
+
+Here's an example of what @emph{not} to do:
+
+@smallexample
+(interactive
+ (list (region-beginning) (region-end)
+ (read-string "Foo: " nil 'my-history)))
+@end smallexample
+
+@noindent
+Here's how to avoid the problem, by examining point and the mark only
+after reading the keyboard input:
+
+@smallexample
+(interactive
+ (let ((string (read-string "Foo: " nil 'my-history)))
+ (list (region-beginning) (region-end) string)))
+@end smallexample
+
@item
@cindex argument prompt
It may be a string; then its contents should consist of a code character