Mercurial > hg > xemacs-beta
diff src/event-stream.c @ 32:e04119814345 r19-15b99
Import from CVS: tag r19-15b99
author | cvs |
---|---|
date | Mon, 13 Aug 2007 08:52:56 +0200 |
parents | ec9a17fef872 |
children | 8d2a9b52c682 |
line wrap: on
line diff
--- a/src/event-stream.c Mon Aug 13 08:52:30 2007 +0200 +++ b/src/event-stream.c Mon Aug 13 08:52:56 2007 +0200 @@ -2357,9 +2357,8 @@ /* This is used in accept-process-output, sleep-for and sit-for. Before running any process_events in these routines, we set recursive_sit_for to Qt, and use this unwind protect to reset it to - Qnil upon exit. When recursive_sit_for is Qt, calling any of these - three routines will cause them to return immediately no matter what - their arguments were. + Qnil upon exit. When recursive_sit_for is Qt, calling sit-for will + cause it to return immediately. All of these routines install timeouts, so we clear the installed timeout as well. @@ -2395,13 +2394,6 @@ If the third arg is non-nil, it is a number of milliseconds that is added to the second arg. (This exists only for compatibility.) Return non-nil iff we received any output before the timeout expired. - -If a filter function or timeout handler (such as installed by `add-timeout') - calls any of accept-process-output, sleep-for, or sit-for, those calls - will return nil immediately (regardless of their arguments) in recursive - situations. It is recommended that you never call accept-process-output - from inside of a process filter function or timer event (either synchronous - or asynchronous). */ (process, timeout_secs, timeout_msecs)) { @@ -2415,10 +2407,6 @@ struct buffer *old_buffer = current_buffer; int count; - /* Recusive call from a filter function or timeout handler. */ - if (!NILP(recursive_sit_for)) - return Qnil; - /* We preserve the current buffer but nothing else. If a focus change alters the selected window then the top level event loop will eventually alter current_buffer to match. In the mean time @@ -2536,12 +2524,8 @@ Pause, without updating display, for ARG seconds. ARG may be a float, meaning pause for some fractional part of a second. -If a filter function or timeout handler (such as installed by `add-timeout') - calls any of accept-process-output, sleep-for, or sit-for, those calls - will return nil immediately (regardless of their arguments) in recursive - situations. It is recommended that you never call sleep-for from inside - of a process filter function or timer event (either synchronous or - asynchronous). +It is recommended that you never call sleep-for from inside of a process + filter function or timer event (either synchronous or asynchronous). */ (seconds)) { @@ -2552,10 +2536,6 @@ int count; struct gcpro gcpro1; - /* Recusive call from a filter function or timeout handler. */ - if (!NILP(recursive_sit_for)) - return Qnil; - GCPRO1 (event); id = event_stream_generate_wakeup (msecs, 0, Qnil, Qnil, 0); @@ -2616,12 +2596,8 @@ happen if input is available before it starts. Value is t if waited the full time with no input arriving. -If a filter function or timeout handler (such as installed by `add-timeout') - calls any of accept-process-output, sleep-for, or sit-for, those calls - will return nil immediately (regardless of their arguments) in recursive - situations. It is recommended that you never call sit-for from inside - of a process filter function or timer event (either synchronous or - asynchronous) with an argument other than 0. +If sit-for is called from within a process filter function or timer + event (either synchronous or asynchronous) it will return immediately. */ (seconds, nodisplay)) { @@ -2632,10 +2608,6 @@ int id; int count; - /* Recusive call from a filter function or timeout handler. */ - if (!NILP(recursive_sit_for)) - return Qnil; - /* The unread-command-events count as pending input */ if (!NILP (Vunread_command_events) || !NILP (Vunread_command_event)) return Qnil; @@ -2657,6 +2629,18 @@ if (noninteractive || !NILP (Vexecuting_macro)) return (Qnil); + /* Recusive call from a filter function or timeout handler. */ + if (!NILP(recursive_sit_for)) + { + if (!event_stream_event_pending_p (1) && NILP (nodisplay)) + { + run_pre_idle_hook (); + redisplay (); + } + return Qnil; + } + + /* Otherwise, start reading events from the event_stream. Do this loop at least once even if (sit-for 0) so that we redisplay when no input pending. @@ -3260,7 +3244,7 @@ like command prefixes; they signal this by setting prefix-arg to non-nil. -- Therefore, we reset this-command-keys when we finish - executing a comand, unless prefix-arg is set. + executing a command, unless prefix-arg is set. -- However, if we ever do a non-local exit out of a command loop (e.g. an error in a command), we need to reset this-command-keys. We do this by calling reset_this_command_keys() @@ -3294,7 +3278,7 @@ /* The following two functions are used in call-interactively, for the @ and e specifications. We used to just use - `current-mouse-event' (i.e. the last mouse event in this-comand-keys), + `current-mouse-event' (i.e. the last mouse event in this-command-keys), but FSF does it more generally so we follow their lead. */ Lisp_Object @@ -4619,10 +4603,7 @@ (/ (- (caddr ,end) (caddr ,start)) 1000000.0))) (defun testee (ignore) - ;; All three of these should return immediately. - (sit-for 10) - (sleep-for 10) - (accept-process-output nil 10)) + (sit-for 10)) (defun test-them () (let ((start (current-time)) @@ -4636,7 +4617,8 @@ (setq end (current-time)) (test-diff-time start end))) -(test-them) should sit for 15 seconds, not 105 or 96. - +(test-them) should sit for 15 seconds. +Repeat with testee set to sleep-for and accept-process-output. +These should each delay 36 seconds. */