diff options
| author | Kim F. Storm | 2004-08-17 22:24:29 +0000 |
|---|---|---|
| committer | Kim F. Storm | 2004-08-17 22:24:29 +0000 |
| commit | 107ed38d4bdec03002b2a23619e205722cd5b8d1 (patch) | |
| tree | c84412d12bdd4817442601d535af19f0f4a6bafb /src/process.c | |
| parent | be16bf871e21bf4cd7fe495251fbd0869b5df4fb (diff) | |
| download | emacs-107ed38d4bdec03002b2a23619e205722cd5b8d1.tar.gz emacs-107ed38d4bdec03002b2a23619e205722cd5b8d1.zip | |
(Faccept_process_output): Add arg JUST-THIS-ONE;
forward to wait_reading_process_input via DO_DISPLAY arg.
(wait_reading_process_input): If DO_DISPLAY < 0 for a process
object, only process output from that process; also inhibit
running timers if DO_DISPLAY==-2.
Diffstat (limited to 'src/process.c')
| -rw-r--r-- | src/process.c | 38 |
1 files changed, 30 insertions, 8 deletions
diff --git a/src/process.c b/src/process.c index 09f55b569dd..49fef36d41a 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -3718,7 +3718,7 @@ close_process_descs () | |||
| 3718 | } | 3718 | } |
| 3719 | 3719 | ||
| 3720 | DEFUN ("accept-process-output", Faccept_process_output, Saccept_process_output, | 3720 | DEFUN ("accept-process-output", Faccept_process_output, Saccept_process_output, |
| 3721 | 0, 3, 0, | 3721 | 0, 4, 0, |
| 3722 | doc: /* Allow any pending output from subprocesses to be read by Emacs. | 3722 | doc: /* Allow any pending output from subprocesses to be read by Emacs. |
| 3723 | It is read into the process' buffers or given to their filter functions. | 3723 | It is read into the process' buffers or given to their filter functions. |
| 3724 | Non-nil arg PROCESS means do not return until some output has been received | 3724 | Non-nil arg PROCESS means do not return until some output has been received |
| @@ -3726,15 +3726,20 @@ from PROCESS. | |||
| 3726 | Non-nil second arg TIMEOUT and third arg TIMEOUT-MSECS are number of | 3726 | Non-nil second arg TIMEOUT and third arg TIMEOUT-MSECS are number of |
| 3727 | seconds and microseconds to wait; return after that much time whether | 3727 | seconds and microseconds to wait; return after that much time whether |
| 3728 | or not there is input. | 3728 | or not there is input. |
| 3729 | If optional fourth arg JUST-THIS-ONE is non-nil, only accept output | ||
| 3730 | from PROCESS, suspending reading output from other processes. | ||
| 3731 | If JUST-THIS-ONE is an integer, don't run any timers either. | ||
| 3729 | Return non-nil iff we received any output before the timeout expired. */) | 3732 | Return non-nil iff we received any output before the timeout expired. */) |
| 3730 | (process, timeout, timeout_msecs) | 3733 | (process, timeout, timeout_msecs, just_this_one) |
| 3731 | register Lisp_Object process, timeout, timeout_msecs; | 3734 | register Lisp_Object process, timeout, timeout_msecs, just_this_one; |
| 3732 | { | 3735 | { |
| 3733 | int seconds; | 3736 | int seconds; |
| 3734 | int useconds; | 3737 | int useconds; |
| 3735 | 3738 | ||
| 3736 | if (! NILP (process)) | 3739 | if (! NILP (process)) |
| 3737 | CHECK_PROCESS (process); | 3740 | CHECK_PROCESS (process); |
| 3741 | else | ||
| 3742 | just_this_one = Qnil; | ||
| 3738 | 3743 | ||
| 3739 | if (! NILP (timeout_msecs)) | 3744 | if (! NILP (timeout_msecs)) |
| 3740 | { | 3745 | { |
| @@ -3776,7 +3781,9 @@ Return non-nil iff we received any output before the timeout expired. */) | |||
| 3776 | XSETFASTINT (process, 0); | 3781 | XSETFASTINT (process, 0); |
| 3777 | 3782 | ||
| 3778 | return | 3783 | return |
| 3779 | (wait_reading_process_input (seconds, useconds, process, 0) | 3784 | (wait_reading_process_input (seconds, useconds, process, |
| 3785 | NILP (just_this_one) ? 0 : | ||
| 3786 | !INTEGERP (just_this_one) ? -1 : -2) | ||
| 3780 | ? Qt : Qnil); | 3787 | ? Qt : Qnil); |
| 3781 | } | 3788 | } |
| 3782 | 3789 | ||
| @@ -4009,8 +4016,11 @@ wait_reading_process_input_1 () | |||
| 4009 | process. The return value is true iff we read some input from | 4016 | process. The return value is true iff we read some input from |
| 4010 | that process. | 4017 | that process. |
| 4011 | 4018 | ||
| 4012 | DO_DISPLAY != 0 means redisplay should be done to show subprocess | 4019 | If READ_KBD is a process object, DO_DISPLAY < 0 means handle only |
| 4013 | output that arrives. | 4020 | output from that process (suspending output from other processes) |
| 4021 | and DO_DISPLAY == -2 specifically means don't run any timers either. | ||
| 4022 | Otherwise, != 0 means redisplay should be done to show subprocess | ||
| 4023 | output that arrives. | ||
| 4014 | 4024 | ||
| 4015 | If READ_KBD is a pointer to a struct Lisp_Process, then the | 4025 | If READ_KBD is a pointer to a struct Lisp_Process, then the |
| 4016 | function returns true iff we received input from that process | 4026 | function returns true iff we received input from that process |
| @@ -4032,6 +4042,7 @@ wait_reading_process_input (time_limit, microsecs, read_kbd, do_display) | |||
| 4032 | EMACS_TIME timeout, end_time; | 4042 | EMACS_TIME timeout, end_time; |
| 4033 | int wait_channel = -1; | 4043 | int wait_channel = -1; |
| 4034 | struct Lisp_Process *wait_proc = 0; | 4044 | struct Lisp_Process *wait_proc = 0; |
| 4045 | int just_wait_proc = 0; | ||
| 4035 | int got_some_input = 0; | 4046 | int got_some_input = 0; |
| 4036 | /* Either nil or a cons cell, the car of which is of interest and | 4047 | /* Either nil or a cons cell, the car of which is of interest and |
| 4037 | may be changed outside of this routine. */ | 4048 | may be changed outside of this routine. */ |
| @@ -4048,6 +4059,11 @@ wait_reading_process_input (time_limit, microsecs, read_kbd, do_display) | |||
| 4048 | wait_proc = XPROCESS (read_kbd); | 4059 | wait_proc = XPROCESS (read_kbd); |
| 4049 | wait_channel = XINT (wait_proc->infd); | 4060 | wait_channel = XINT (wait_proc->infd); |
| 4050 | XSETFASTINT (read_kbd, 0); | 4061 | XSETFASTINT (read_kbd, 0); |
| 4062 | if (do_display < 0) | ||
| 4063 | { | ||
| 4064 | just_wait_proc = do_display; | ||
| 4065 | do_display = 0; | ||
| 4066 | } | ||
| 4051 | } | 4067 | } |
| 4052 | 4068 | ||
| 4053 | /* If waiting for non-nil in a cell, record where. */ | 4069 | /* If waiting for non-nil in a cell, record where. */ |
| @@ -4122,7 +4138,8 @@ wait_reading_process_input (time_limit, microsecs, read_kbd, do_display) | |||
| 4122 | But not if wait_for_cell; in those cases, | 4138 | But not if wait_for_cell; in those cases, |
| 4123 | the wait is supposed to be short, | 4139 | the wait is supposed to be short, |
| 4124 | and those callers cannot handle running arbitrary Lisp code here. */ | 4140 | and those callers cannot handle running arbitrary Lisp code here. */ |
| 4125 | if (NILP (wait_for_cell)) | 4141 | if (NILP (wait_for_cell) |
| 4142 | && just_wait_proc != -2) | ||
| 4126 | { | 4143 | { |
| 4127 | EMACS_TIME timer_delay; | 4144 | EMACS_TIME timer_delay; |
| 4128 | 4145 | ||
| @@ -4258,7 +4275,12 @@ wait_reading_process_input (time_limit, microsecs, read_kbd, do_display) | |||
| 4258 | 4275 | ||
| 4259 | /* Wait till there is something to do */ | 4276 | /* Wait till there is something to do */ |
| 4260 | 4277 | ||
| 4261 | if (!NILP (wait_for_cell)) | 4278 | if (just_wait_proc) |
| 4279 | { | ||
| 4280 | FD_SET (XINT (wait_proc->infd), &Available); | ||
| 4281 | check_connect = check_delay = 0; | ||
| 4282 | } | ||
| 4283 | else if (!NILP (wait_for_cell)) | ||
| 4262 | { | 4284 | { |
| 4263 | Available = non_process_wait_mask; | 4285 | Available = non_process_wait_mask; |
| 4264 | check_connect = check_delay = 0; | 4286 | check_connect = check_delay = 0; |