diff options
| author | Richard M. Stallman | 1995-02-25 20:57:45 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1995-02-25 20:57:45 +0000 |
| commit | 3a2485be17c9ec8ed549bf001a1bf478b5371cdc (patch) | |
| tree | 88a019b40396f2ff881e37b85886ac0145d33b48 | |
| parent | 39a185a95115fd9728d7afb2db162993601a6264 (diff) | |
| download | emacs-3a2485be17c9ec8ed549bf001a1bf478b5371cdc.tar.gz emacs-3a2485be17c9ec8ed549bf001a1bf478b5371cdc.zip | |
Warn that interactive should get point and mark only after minibuffer input.
| -rw-r--r-- | lispref/commands.texi | 25 |
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 | |||
| 178 | command. | 178 | command. |
| 179 | @cindex argument evaluation form | 179 | @cindex argument evaluation form |
| 180 | 180 | ||
| 181 | If this expression reads keyboard input (this includes using the | ||
| 182 | minibuffer), keep in mind that the integer value of point or the mark | ||
| 183 | before reading input may be incorrect after reading input. This is | ||
| 184 | because the current buffer may be receiving subprocess output; | ||
| 185 | if subprocess output arrives while the command is waiting for input, | ||
| 186 | it could relocate point and the mark. | ||
| 187 | |||
| 188 | Here's an example of what @emph{not} to do: | ||
| 189 | |||
| 190 | @smallexample | ||
| 191 | (interactive | ||
| 192 | (list (region-beginning) (region-end) | ||
| 193 | (read-string "Foo: " nil 'my-history))) | ||
| 194 | @end smallexample | ||
| 195 | |||
| 196 | @noindent | ||
| 197 | Here's how to avoid the problem, by examining point and the mark only | ||
| 198 | after reading the keyboard input: | ||
| 199 | |||
| 200 | @smallexample | ||
| 201 | (interactive | ||
| 202 | (let ((string (read-string "Foo: " nil 'my-history))) | ||
| 203 | (list (region-beginning) (region-end) string))) | ||
| 204 | @end smallexample | ||
| 205 | |||
| 181 | @item | 206 | @item |
| 182 | @cindex argument prompt | 207 | @cindex argument prompt |
| 183 | It may be a string; then its contents should consist of a code character | 208 | It may be a string; then its contents should consist of a code character |