diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/dispnew.c | 43 |
1 files changed, 28 insertions, 15 deletions
diff --git a/src/dispnew.c b/src/dispnew.c index 90376d05057..3519e2d64fe 100644 --- a/src/dispnew.c +++ b/src/dispnew.c | |||
| @@ -6495,27 +6495,40 @@ Emacs was built without floating point support. | |||
| 6495 | 6495 | ||
| 6496 | 6496 | ||
| 6497 | /* This is just like wait_reading_process_output, except that | 6497 | /* This is just like wait_reading_process_output, except that |
| 6498 | it does redisplay. */ | 6498 | it does redisplay. |
| 6499 | |||
| 6500 | TIMEOUT is number of seconds to wait (float or integer). | ||
| 6501 | READING is 1 if reading input. | ||
| 6502 | If DO_DISPLAY is >0 display process output while waiting. | ||
| 6503 | If DO_DISPLAY is >1 perform an initial redisplay before waiting. | ||
| 6504 | */ | ||
| 6499 | 6505 | ||
| 6500 | Lisp_Object | 6506 | Lisp_Object |
| 6501 | sit_for (sec, usec, reading, display, initial_display) | 6507 | sit_for (timeout, reading, do_display) |
| 6502 | int sec, usec, reading, display, initial_display; | 6508 | Lisp_Object timeout; |
| 6509 | int reading, do_display; | ||
| 6503 | { | 6510 | { |
| 6504 | int preempt = (sec > 0) || (sec == 0 && usec >= 0); | 6511 | int sec, usec; |
| 6505 | 6512 | ||
| 6506 | swallow_events (display); | 6513 | swallow_events (do_display); |
| 6507 | 6514 | ||
| 6508 | if ((detect_input_pending_run_timers (display) && preempt) | 6515 | if ((detect_input_pending_run_timers (do_display)) |
| 6509 | || !NILP (Vexecuting_kbd_macro)) | 6516 | || !NILP (Vexecuting_kbd_macro)) |
| 6510 | return Qnil; | 6517 | return Qnil; |
| 6511 | 6518 | ||
| 6512 | if (initial_display) | 6519 | if (do_display >= 2) |
| 6520 | redisplay_preserve_echo_area (2); | ||
| 6521 | |||
| 6522 | if (FLOATP (timeout)) | ||
| 6523 | { | ||
| 6524 | double seconds = XFLOAT_DATA (timeout); | ||
| 6525 | sec = (int) seconds; | ||
| 6526 | usec = (int) ((seconds - sec) * 1000000); | ||
| 6527 | } | ||
| 6528 | else | ||
| 6513 | { | 6529 | { |
| 6514 | int count = SPECPDL_INDEX (); | 6530 | sec = XFASTINT (timeout); |
| 6515 | if (!preempt) | 6531 | usec = 0; |
| 6516 | specbind (Qredisplay_dont_pause, Qt); | ||
| 6517 | redisplay_preserve_echo_area (2); | ||
| 6518 | unbind_to (count, Qnil); | ||
| 6519 | } | 6532 | } |
| 6520 | 6533 | ||
| 6521 | if (sec == 0 && usec == 0) | 6534 | if (sec == 0 && usec == 0) |
| @@ -6525,7 +6538,7 @@ sit_for (sec, usec, reading, display, initial_display) | |||
| 6525 | gobble_input (0); | 6538 | gobble_input (0); |
| 6526 | #endif | 6539 | #endif |
| 6527 | 6540 | ||
| 6528 | wait_reading_process_output (sec, usec, reading ? -1 : 1, display, | 6541 | wait_reading_process_output (sec, usec, reading ? -1 : 1, do_display, |
| 6529 | Qnil, NULL, 0); | 6542 | Qnil, NULL, 0); |
| 6530 | 6543 | ||
| 6531 | return detect_input_pending () ? Qnil : Qt; | 6544 | return detect_input_pending () ? Qnil : Qt; |
| @@ -6541,8 +6554,8 @@ perform a full redisplay even if input is available. */) | |||
| 6541 | { | 6554 | { |
| 6542 | int count; | 6555 | int count; |
| 6543 | 6556 | ||
| 6544 | swallow_events (Qt); | 6557 | swallow_events (1); |
| 6545 | if ((detect_input_pending_run_timers (Qt) | 6558 | if ((detect_input_pending_run_timers (1) |
| 6546 | && NILP (force) && !redisplay_dont_pause) | 6559 | && NILP (force) && !redisplay_dont_pause) |
| 6547 | || !NILP (Vexecuting_kbd_macro)) | 6560 | || !NILP (Vexecuting_kbd_macro)) |
| 6548 | return Qnil; | 6561 | return Qnil; |