changeset 10834:e79e5c9e7722

Warn that interactive should get point and mark only after minibuffer input.
author Richard M. Stallman <rms@gnu.org>
date Sat, 25 Feb 1995 20:57:45 +0000
parents 77d7d3990300
children cd9261d8d347
files lispref/commands.texi
diffstat 1 files changed, 25 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/lispref/commands.texi	Sat Feb 25 16:24:51 1995 +0000
+++ b/lispref/commands.texi	Sat Feb 25 20:57:45 1995 +0000
@@ -178,6 +178,31 @@
 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