- Subject: Re: infinite loop when using read_mini
- From: "John E. Davis" <davis@xxxxxxxxxxxxx>
- Date: Wed, 30 Nov 2005 11:42:58 -0500
Marvin Lyndon <marvin.lyndon@xxxxxxxxxxx> wrote:
>Consider a small file called test.sl
[...]
Please try the patch appended below. It should solve the problem.
>define test()
>{
> variable input;
>
> do
> {
> try {input = read_mini("type something","","");}
>
> catch UserBreakError: {return "";}
> } while (strlen(input) == 0);
>
> return input;
>}
The read_mini function will return "" if the user aborted the
read_mini function via, e.g., ^G. However, read_mini also clears the
error state, which means that you will not see the UserBreakError
error. Judging from the code above, this is probably not what you
want. Changing the behavior of read_mini to return NULL, or throw an
exception will cause compatibility problems. For this reason, I would
prefer to add a similar function with different semantics, e.g.,
`read_mini_with_exception` or `_read_mini`.
Here is the patch that fixes the loop:
--- misc.c~ 2005-05-22 00:35:42.000000000 -0400
+++ misc.c 2005-11-30 11:26:34.000000000 -0500
@@ -424,7 +424,11 @@
eob();
ret = make_buffer_substring(n);
}
- else ret = NULL;
+ else
+ {
+ SLKeyBoard_Quit = 0;
+ ret = NULL;
+ }
/* we should be in minibuffer so delete marks and spots */
while (CBuf->spots) pop_spot();
Thanks,
--John
--------------------------
To unsubscribe send email to <jed-users-request@xxxxxxxxxxx> with
the word "unsubscribe" in the message body.
Need help? Email <jed-users-owner@xxxxxxxxxxx>.
[2005 date index]
[2005 thread index]
[Thread Prev] [Thread Next]
[Date Prev] [Date Next]